Adding No overwrite for copy operation#9592
Conversation
aemous
left a comment
There was a problem hiding this comment.
Looks good overall, very nice test coverage!
I requested some changes, most of them are minor. I had one concern with how we are handling copies of 0 byte objects with no-overwrite.
71f54ae to
ee0b977
Compare
aemous
left a comment
There was a problem hiding this comment.
Looks good overall, a couple minor requests, and we'll discuss potentially using LIstObjectsV2 instead of HeadObject offline.
89dcfbd to
79e2504
Compare
f39bcd6 to
039f4b6
Compare
kdaily
left a comment
There was a problem hiding this comment.
Good start! I think the logic makes sense. I think that the function names and documentation could be clarified a bit.
Also, see the suggestion about where the check is determined. There is an existing list of warning handlers that is used to skip files - could the logic be handled there, since it only needs the FileInfo object to determine?
Also, I noticed that there is a "flicker" in the terminal output when skipping a file with this. We might need to check how the progress status is updated in this case.
updated linting changes Handling Zero byte edge case Fixed Exception type Updated doc string Updated docs string Fixed doc string Update transfer manager for copy operation
improved test case and format Updated test cases Fixed edge case for zero bytes Update warning handler
211e9e4 to
75678ed
Compare
aemous
left a comment
There was a problem hiding this comment.
LGTM. I made one non-blocking formatting-related comment.
This reverts commit 2493f8b.
Issue : Github Issue #2874
Description of changes:
Customers requested to prevent overwriting of objects. This is done by providing
no-overwriteheader usingifNoneMatchwith Etags to transfer objects that are not present on the bucket. However, retrieval of etags is difficult hence during copy operation always perform multipart copy since it follows multipart upload approach which indeed supportsifNoneMatchheader without Etags. Theno-overwriteheader works well with othercpcommand headers. Customer can be implemented usingaws s3 cp <source> <destination> --no-overwritewhich allows successful transfers when object with the same name is not present on the destination. However, if the user tries to transfer the object which is already present at the target bucket using command line, awarningabout skipping the file will be generated and that object is not allowed to transfer to S3 bucket.Testing:
Functional testing is performed to validate the object copy process. This included both scenarios copying an object when object with same key is already present in the bucket as well as those when the object with same key is not present on bucket. These tests were conducted for both object having size less than multipart threshold and one with greater than multipart threshold