fix CopyObject swallowing errors embedded in a 200 OK response - #2306
Conversation
S3 can answer a failed CopyObject with 200 OK and an <Error> document in the body, but CopyObject never enabled expect200OKWithError, so the body was decoded into a field-less copyObjectResult and the failure came back as a nil error with an empty ETag. The multipart and RemoveObjects paths already set the flag; CopyObject was the remaining 2xx-with-error path that did not. Signed-off-by: huanghaoyuanhhy <haoyuan.huang@zilliz.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthrough
ChangesCopyObject embedded error handling
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to CopyObject now reports embedded S3 errors and retries them; no concrete merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit found an error tucked in green, Comment |
|
Windows CI unrelated, fixed in #2307 |
| customHeader: header, | ||
| // S3 can answer a failed CopyObject with 200 OK and an embedded <Error> | ||
| // body, so this request must parse the body for an error instead of | ||
| // trusting the status code. |
There was a problem hiding this comment.
Please add this document URL https://repost.aws/knowledge-center/s3-resolve-200-internalerror in the comments, and there's no need for such a lengthy explanation.
jiuker
left a comment
There was a problem hiding this comment.
Code is fine. Just for the comments.
Fixes #2305
Sets expect200OKWithError on CopyObject so executeMethod parses the body for an embedded instead of trusting the 200 status, matching what CompleteMultipartUpload and RemoveObjects already do.
Added Test200CopyObjectWithError, modeled on Test200MultipartUploadWithError: it fails before the change (CopyObject returns nil) and passes after, including the retry. Ran go test -short -race ./... and go build, both clean.
Summary by CodeRabbit
Bug Fixes
Tests