Uh oh!
There was an error while loading. Please reload this page.
HDDS-10653. Support custom metadata for MPU key - #6489
Conversation
@kerneltime@DaveTeng0@SaketaChalamchala@vtutrinov Could you help take a look when you have time? |
kerneltime
commented
Apr 8, 2024
cc @SaketaChalamchala@tanvipenumudy@vtutrinov can you'll please take a look? |
vtutrinov
commented
Apr 12, 2024
@ivandika3 thanks for the changes. LGTM at first glance, going to continue the review a little bit later |
adoroszlai
left a comment
There was a problem hiding this comment.
Thanks @ivandika3 for the patch.
| import static org.mockito.ArgumentMatchers.anyMap; | ||
| import static org.mockito.Mockito.any; | ||
| import static org.mockito.Mockito.anyBoolean; | ||
| import static org.mockito.Mockito.anyLong; |
There was a problem hiding this comment.
nit: import from Mockito.
| importstaticorg.mockito.ArgumentMatchers.anyMap; | |
| importstaticorg.mockito.Mockito.any; | |
| importstaticorg.mockito.Mockito.anyBoolean; | |
| importstaticorg.mockito.Mockito.anyLong; | |
| importstaticorg.mockito.Mockito.any; | |
| importstaticorg.mockito.Mockito.anyBoolean; | |
| importstaticorg.mockito.Mockito.anyLong; | |
| importstaticorg.mockito.Mockito.anyMap; |
There was a problem hiding this comment.
Thank you for the review. Updated.
| for (Map.Entry<String, String> customEntry : customMetadata.entrySet()) { | ||
| assertTrue(keyMetadata.containsKey(customEntry.getKey())); | ||
| assertEquals(customEntry.getValue(), keyMetadata.get(customEntry.getKey())); | ||
| } |
There was a problem hiding this comment.
Use assertThat instead of assertTrue for better message in case of failure. It also provides assertions for maps.
| for (Map.Entry<String, String> customEntry : customMetadata.entrySet()) { | |
| assertTrue(keyMetadata.containsKey(customEntry.getKey())); | |
| assertEquals(customEntry.getValue(), keyMetadata.get(customEntry.getKey())); | |
| } | |
| assertThat(keyMetadata).containsAllEntriesOf(customMetadata); |
There was a problem hiding this comment.
Thank you for the suggestion. Updated with assertThat (also updated for other similar tests).
I'll try to use more assertThat APIs in the future.
There was a problem hiding this comment.
Some test failure due to the last commit, let me fix it first.
vtutrinov
commented
Apr 16, 2024
@ivandika3 thanks for the patch, LGTM, +1 |
adoroszlai
left a comment
There was a problem hiding this comment.
Thanks @ivandika3 for updating the patch.
| String multipartUploadID = keyToMultipartUpload.get(key).getUploadId(); | ||
| if (multipartUploadID == null || !multipartUploadID.equals(uploadID)) { |
There was a problem hiding this comment.
Wouldn't keyToMultipartUpload.get(key) == null indicate "no such upload? We'd hit NPE in that case. I guess MultipartInfoStub#uploadID would rarely be null.
(createMultipartKey seems to have the correct logic.)
There was a problem hiding this comment.
Thank you for catching it. I have updated it as the same logic as createMultipartKey.
adoroszlai
commented
Apr 22, 2024
Thanks @ivandika3 for the patch, @vtutrinov for the review. |
ivandika3
commented
Apr 22, 2024
Thank you @vtutrinov and @adoroszlai for the reviews. |
(cherry picked from commit d10a822)
(cherry picked from commit d10a822)
(cherry picked from commit d10a822)
(cherry picked from commit d10a822)
(cherry picked from commit d10a822)
(cherry picked from commit d10a822)
What changes were proposed in this pull request?
HDDS-6440 added support for custom metadata for normal object creation.
We should also support custom metadata creation for multipart upload key.
The metadata should be set during the multipart upload initiation request, which will be committed during the multipart upload complete request.
See: https://docs.aws.amazon.com/cli/latest/reference/s3api/create-multipart-upload.html
Should be tested using unit tests and acceptance tests.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-10653
How was this patch tested?
Unit, integration, and acceptance tests.
Clean CI: https://github.com/ivandika3/ozone/actions/runs/8581916553