chungen0126 opened a new pull request, #11479:
URL: https://github.com/apache/ozone/pull/11479

   ## What changes were proposed in this pull request?
   
   S3 Gateway resolves the S3 volume with a separate `GetS3VolumeContext` call 
(`getS3Volume`) before looking up a bucket. Following HDDS-7324, which did the 
same for `GetKeyInfo`, this patch lets OM resolve the S3 volume inside the 
`InfoBucket` call, so a bucket lookup takes one RPC instead of two.
   
   - **Protocol:** `OMRequest` gets an optional `assumeS3Context` flag. When it 
is set on `InfoBucket`, OM resolves the S3 volume itself (multi-tenancy aware) 
and returns the volume info and user principal in `OMResponse`.
   - **Client:** `RpcClient.getS3BucketDetails` uses this in a single 
`InfoBucket` call and updates the S3 principal from the response. Older OMs 
ignore `assumeS3Context` and would look up the bucket in the default S3 volume. 
To stay correct under multi-tenancy, the client is gated on a new 
`OzoneManagerVersion.S3_BUCKET_INFO_WITH_VOLUME_CONTEXT`; for older OMs it 
falls back to `GetS3VolumeContext` + `InfoBucket`.
   - **S3 Gateway:**
     - `S3RequestContext` caches the bucket for the request, so the owner check 
and the handler share one lookup.
     - `getVolumeName()` reuses the cached bucket's volume when the bucket has 
already been looked up.
     - Bucket lookups now use `getS3BucketDetails`: HEAD bucket, list objects, 
multi-delete, bucket ACL, bucket tagging, bucket lifecycle, delete bucket and 
list multipart uploads (owner checks), HEAD object, multipart upload 
init/complete, put object, and copy source owner checks.
   
   Object tagging is unchanged: it still makes one `getS3Volume` call (see 
HDDS-16603). Removing that call would need OM to resolve the S3 volume for 
tagging requests too, which is left for a follow-up.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-16681
   
   ## How was this patch tested?
   
   - New unit test `TestRpcClientGetS3BucketDetails` covers both cases:
     - **New OM:** only `InfoBucket` is sent, with `assumeS3Context`.
     - **Older OM:** the client falls back to `GetS3VolumeContext` + 
`InfoBucket`.
   - Extended `TestMultiTenantVolume` to cover `getS3BucketDetails` for the 
default S3 volume and for tenant volumes, including the principal update and 
bucket-not-found.
   - Updated the affected S3 Gateway unit tests and added lookup-count checks 
for lifecycle PUT and list multipart uploads.
   - Ran the `ozone-client` and `ozone-s3gateway` unit tests, 
`TestMultiTenantVolume`, `checkstyle.sh` and `rat.sh` locally.
   
   Generated-by: Claude Code (Claude Opus 5.5)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to