HDDS-15510. Implement OM read/write paths for bucket tagging with audit and metrics#10498
HDDS-15510. Implement OM read/write paths for bucket tagging with audit and metrics#10498Gargi-jais11 wants to merge 1 commit into
Conversation
|
@ivandika3, @peterxcli and @ChenSammi could you please review this 2nd PR for bucketTagging implementation. |
sreejasahithi
left a comment
There was a problem hiding this comment.
Thanks @Gargi-jais11 for the PR. left few comments wrt the tests added.
Please add assertions in the success tests that the saved bucket is updated correctly, not only the tags.
Where:
TestS3PutBucketTaggingRequest.testValidateAndUpdateCacheSuccess — after the tag assertions
TestS3DeleteBucketTaggingRequest.testValidateAndUpdateCacheSuccess — after the tag assertions
Add:
assertThat(updatedBucketInfo.getModificationTime())
.isGreaterThan(bucketInfo.getModificationTime());
assertEquals(2L, updatedBucketInfo.getUpdateID());
because the requirement says PUT/DELETE should update modification time. testPreExecute only checks that the request gets a new modificationTime, the success tests never verify it was persisted on the bucket. updateID should match the transaction index passed to validateAndUpdateCache (2L in these tests), that is also not checked today.
There was a problem hiding this comment.
you can add a test to verify that a second PutBucketTagging replaces the existing tag set instead of merging with it.
There was a problem hiding this comment.
That will be added in later part of the Bucket Tagging implementation when client side implementation is also done.
This is only for ozone manager side implementation for put an delete request.
There was a problem hiding this comment.
The test i am suggesting is OM-only though, as S3PutBucketTaggingRequest already replaces tags via setTags(), so we can cover it with a unit test here (two puts, assert old keys are gone).
There was a problem hiding this comment.
Okay let me see as initially I had added it. But then removed on taking reference from objectTagging OM side unit tests.
| OmBucketInfo updatedBucketInfo = getBucketFromDb(volumeName, bucketName); | ||
| assertEquals(bucketInfo.getVolumeName(), updatedBucketInfo.getVolumeName()); | ||
| assertEquals(bucketInfo.getBucketName(), updatedBucketInfo.getBucketName()); | ||
| assertTrue(bucketInfo.getTags().isEmpty()); |
There was a problem hiding this comment.
we should do:
assertTrue(updatedBucketInfo.getTags().isEmpty());
because current line checks the old object before update, not the result.
What changes were proposed in this pull request?
Implement Ozone Manager support for storing and retrieving S3-style bucket tags on OmBucketInfo. PUT and DELETE are write operations; GET is a read path via OmMetadataReader. Tags are stored on the source bucket record in OM DB.
Scope:
- Write path
- Read path
- Bucket Links
- OM unit tests
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-15510
How was this patch tested?
Added two new unit tests
TestS3PutBucketTaggingandTestS3DeleteBucketTagging.