Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Gateway wrong error description for copy object #7526

Merged
merged 4 commits into from
Mar 5, 2024

Conversation

N-o-Z
Copy link
Member

@N-o-Z N-o-Z commented Mar 3, 2024

Closes #7452

Partial fix for the issue.
Fix error description for copy object errors in S3 GW

@N-o-Z N-o-Z added bug Something isn't working area/gateway Changes to the gateway include-changelog PR description should be included in next release changelog labels Mar 3, 2024
@N-o-Z N-o-Z requested a review from guy-har March 3, 2024 13:04
@N-o-Z N-o-Z self-assigned this Mar 3, 2024
Copy link

github-actions bot commented Mar 3, 2024

E2E Test Results - DynamoDB Local - Local Block Adapter

10 passed

Copy link
Contributor

@itaiad200 itaiad200 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix and for adding a test! I suggest a minor refactor to avoid future confusion

@@ -31,12 +31,12 @@ func (controller *DeleteObject) HandleAbortMultipartUpload(w http.ResponseWriter
mpu, err := o.MultipartTracker.Get(ctx, uploadID)
if err != nil {
o.Log(req).WithError(err).Error("upload id not found in tracker")
_ = o.EncodeError(w, req, err, gatewayerrors.Codes.ToAPIErr(gatewayerrors.ErrNoSuchKey))
_ = o.EncodeError(w, req, err, gatewayerrors.Codes.ToAPIErr(gatewayerrors.ErrNoSuchKey, nil))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to pass the actual error instead of nil to all of these calls?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We decided to limit the scope of the current fix to the CopyObject API.
We need to consider a more holistic approach for the actual solution that might require a deeper fix

@@ -176,20 +176,24 @@ const (

type errorCodeMap map[APIErrorCode]APIError

func (e errorCodeMap) ToAPIErr(errCode APIErrorCode) APIError {
func (e errorCodeMap) ToAPIErr(errCode APIErrorCode, err error) APIError {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a function

func (e errorCodeMap) ToAPIErrWithInternalError(errCode APIErrorCode, err error) APIError {

It could leverage the existing ToAPIErr func.
That way you won't have dozens of calls to ToAPIErr with nil as the err, although an actual error does exist. I also wonder what the next caller to this funciton would do, pass an err or nil?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 546 to 547
//destRepo := createRepositoryByName(ctx, t, destRepoName)
//defer deleteRepositoryIfAskedTo(ctx, destRepoName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete?

@N-o-Z N-o-Z requested a review from itaiad200 March 4, 2024 08:43
Copy link
Contributor

@guy-har guy-har left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good,
what is expected in case non graverler errors, such as validation? can you please add a test, just so we know whats expected

@@ -2,6 +2,7 @@ package esti

import (
"bytes"
"github.com/treeverse/lakefs/pkg/block"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move down

Copy link
Contributor

@itaiad200 itaiad200 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for applying the fixes!

@N-o-Z N-o-Z enabled auto-merge (squash) March 5, 2024 14:20
@N-o-Z N-o-Z merged commit 85f9b9d into master Mar 5, 2024
35 checks passed
@N-o-Z N-o-Z deleted the fix/gateway-wrong-error-description-7452 branch March 5, 2024 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gateway Changes to the gateway bug Something isn't working include-changelog PR description should be included in next release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

S3 Gateway: Wrong error message when try to use copy_object with size > 5GB
3 participants