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

   ## What changes were proposed in this pull request?
   
   `ozone admin om list-open-files` fails with `NumberFormatException` when the 
listed range contains an open S3 multipart upload. 
`OmMetadataManagerImpl.listOpenFiles` parses the last segment of every open key 
as a client ID, but the open key that `S3InitiateMultipartUploadRequest` writes 
for an upload ends with the upload ID instead. The exception is not an 
`IOException`, so the client sees a `RemoteException` and retries, and the 
whole listing fails.
   
   This change detects an upload row by its key with the existing 
`OMMultipartUploadUtils.getUploadIdFromDbKey` and lists it with client ID 0, 
which no real client has. The check is key based rather than based on the 
`isMultipartKey` flag, because the open keys of parts being written also carry 
that flag and do end with a real client ID, and upload rows written before 
HDDS-9017 do not carry it. Listing the row instead of skipping it keeps the 
result consistent with `totalOpenKeyCount` and leaves pagination unchanged.
   
   The fix and the test are based on the patch Siyao Meng attached to the JIRA 
issue.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-17251
   
   ## How was this patch tested?
   
   Added `testListOpenFilesWithMultipartUpload` to `TestOmMetadataManager`, for 
every bucket layout, with and without a continuation token. It lists a plain 
open key, an upload row without the `isMultipartKey` flag, and the open key of 
a part being written.
   
   - `mvn test -pl hadoop-ozone/ozone-manager -Dtest=TestOmMetadataManager`: 33 
tests pass.
   - With the change to `OmMetadataManagerImpl` reverted, the new test fails 
for all 3 bucket layouts with `NumberFormatException`.
   - `mvn checkstyle:check -pl hadoop-ozone/ozone-manager`: clean.
   


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