Refactor duplicated S3 object tagging request code into shared base class#4
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Conversation
… OMSnapshotCreateRequest.getBucketInfo duplication - Extract S3ObjectTaggingRequest abstract base class consolidating ~90% duplicated code between S3PutObjectTaggingRequest and S3DeleteObjectTaggingRequest (both OBS and FSO variants) - Replace OMSnapshotCreateRequest.getBucketInfo copy-paste with OMKeyRequest.getBucketInfo static call Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR eliminates duplicated code in the OM S3 object tagging request handlers and removes a copy-pasted method in
OMSnapshotCreateRequest.S3 Object Tagging — extract
S3ObjectTaggingRequestabstract baseS3PutObjectTaggingRequestandS3DeleteObjectTaggingRequest(plus their FSO variants) had ~90% identicalpreExecuteandvalidateAndUpdateCacheimplementations. The only differences were:setTags(KeyValueUtil.getFromProtobuf(...))vssetTags(Collections.emptyMap())incNumPutObjectTaggingvsincNumDeleteObjectTaggingA new abstract
S3ObjectTaggingRequestbase class now provides the commonpreExecute, OBSvalidateAndUpdateCache, and FSOvalidateAndUpdateCacheFSOtemplate methods. Concrete subclasses supply only the operation-specific hooks via abstract methods:The FSO variants (
S3PutObjectTaggingRequestWithFSO,S3DeleteObjectTaggingRequestWithFSO) are now reduced to a singlevalidateAndUpdateCacheoverride that delegates tovalidateAndUpdateCacheFSO.OMSnapshotCreateRequest.getBucketInfo→OMKeyRequest.getBucketInfoThe method was explicitly documented as "Same as OMKeyRequest#getBucketInfo" and was a copy-paste. Replaced with a call to the existing
staticmethodOMKeyRequest.getBucketInfo(...).Net effect: ~105 fewer lines of duplicated code across 6 files.
Generated-by: Devin (Claude)
What is the link to the Apache JIRA
N/A — this is a refactoring-only change on a personal fork.
How was this patch tested?
TestS3PutObjectTaggingRequest,TestS3DeleteObjectTaggingRequest,TestS3PutObjectTaggingRequestWithFSO,TestS3DeleteObjectTaggingRequestWithFSO,TestS3PutObjectTaggingResponse,TestS3DeleteObjectTaggingResponse,TestS3PutObjectTaggingResponseWithFSO,TestS3DeleteObjectTaggingResponseWithFSOTestOMSnapshotCreateRequestpasses (18 tests)checkstyle.sh: 0 violationsrat.sh: passes (license headers on new file verified)mvn -pl :ozone-manager -am install -DskipTests -DskipShade -DskipRecon -DskipDocssucceedsLink to Devin session: https://app.devin.ai/sessions/874da879b185407abe9f9f882e95865d
Requested by: @marcuslin123