[#589] Add LimitExceeded error #593
No reviewers
Labels
No labels
P0
P1
P2
P3
good first issue
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-s3-gw#593
Loading…
Reference in a new issue
No description provided.
Delete branch "r.loginov/frostfs-s3-gw:feature/589-return-quota-limit-reached_status"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
close #589
As part of this PR, an error was added when access was denied due to exceeding the quota. Examples of how it used to be and how it is now:
(In a situation where we receive an error exceeding the quota from the node)
before:
now:
@ -1766,0 +1770,4 @@
ErrCode: ErrLimitExceeded,
Code: "LimitExceeded",
Description: "You have reached the quota limit.",
HTTPStatusCode: http.StatusConflict,
It seems to me that the StatusConflict is not very suitable for quota limit errors. Maybe we should use another response code, such as TooManyRequests or Forbidden?
That's a good point. I agree that at first glance, the
Conflict
status is not quite appropriateI used it for two reasons:
This is exactly the situation we are in. Upon receiving a message that the quota has been exceeded, the user can remove this quota himself by deleting related resources. And resend the request, which will work successfully.
Using the Too Many Requests status doesn't seem quite right, because based on RFC 6585, this status is used in communications when a user has sent too many requests in a given period of time. And in our situation, we are talking specifically about the resource quota (the amount of space occupied, the number of containers, the number of objects).
Using the Forbidden status can be considered for use in this situation. However, I am a little confused that if you follow RFC 9110, then this status is used in situations where a user with certain credentials does not have access to this resource. On the one hand, this is true, but only create/put operations are not available to the user. The user may well request and delete the resource. Moreover, it turns out that the user can delete the data in the resource himself, thereby removing his quota. It doesn't seem to be the behavior that the current status implies.
However, I don't have a clear opinion on whether to use Conflict or Forbidden. Let's also wait for the opinions of other reviewers.
We have agreed that we will use the 409 Conflict
[#589] Add LimitExceeded errorto WIP: [#589] Add LimitExceeded error@ -477,6 +477,9 @@ func handleObjectError(msg string, err error) error {
}
if reason, ok := frosterr.IsErrObjectAccessDenied(err); ok {
if strings.Contains(reason, "Quota limit reached") {
Can we ensure if reason always stars with capital letter?
Probably we can check this in lowercased reason or find just
limit reached
LGTM, but see comment
c58334a378
to3e3b36ead8
New commits pushed, approval review dismissed automatically according to repository settings
WIP: [#589] Add LimitExceeded errorto [#589] Add LimitExceeded errorView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.