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

   ## What changes were proposed in this pull request?
   
   `OmMetadataManagerImpl#listKeys` decides whether to seek to startKey by 
comparing startKey with keyPrefix.
   HDDS-17308 compares the raw names, but the seek and the prefix match use DB 
keys. `getOzoneKey` maps keyPrefix `/`
   to the DB prefix of the bucket (`/volume/bucket/`), so it matches every key 
in the bucket, including keys that sort
   before `/` such as `.cache/0`.
   
   When a page ends at such a key, the next call has a startKey that sorts 
before `/`. listKeys then seeks to the start
   of the bucket instead of startKey and returns the same keys again. 
`OzoneBucket.KeyIterator` always asks for the next
   page with the last key, and S3 Gateway drops every key that does not start 
with `/`, so ListObjects never returns.
   
   Steps to reproduce:
   
   1. Create an OBS bucket and put key `.cache/0`.
   2. `aws s3api list-objects-v2 --prefix /`
   
   Actual: the request never returns; S3 Gateway keeps calling OM listKeys even 
after the client times out.
   Expected: an empty result.
   
   This PR compares the DB key of startKey with the DB key of keyPrefix, which 
is what the seek uses. A startKey from
   the previous page always matches the prefix, so listKeys seeks to it and 
skips it, and every page moves forward.
   For a keyPrefix other than `/`, both DB keys are `/volume/bucket/` followed 
by the name, so the result is the same
   as with HDDS-17308.
   
   FSO buckets are not affected, as S3 Gateway lists them through listStatus.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-17564
   
   ## How was this patch tested?
   
   Added 
`TestOmMetadataManager#testListKeysWithSlashPrefixAndStartKeyBeforeSlash` and
   `AbstractS3SDKV2Tests#testListObjectsSlashPrefix`.
   
   Generated-by: Claude Code (claude-opus-5-5)
   


-- 
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