Repository navigation
HDDS-17251. List open multipart uploads in ListOpenFiles - #11739
Conversation
| long clientID = OMMetadataManager.getClientIDFromOpenKeyDBKey(dbKey); | ||
| // The open key of a multipart upload ends with the upload ID and has no client ID | ||
| final boolean isUpload = OMMultipartUploadUtils.getUploadIdFromDbKey(dbKey) != null; | ||
| long clientID = isUpload ? 0 : OMMetadataManager.getClientIDFromOpenKeyDBKey(dbKey); |
There was a problem hiding this comment.
nit: I think you use 0 to mean "no client ID" for an upload
Since there's already a comment right above, maybe we could just extend it to make this explicit?
There was a problem hiding this comment.
Thanks, extended the comment to state that client ID 0 means the upload has no client ID.
|
Thanks @adoroszlai, enabled. The fork CI link is now in the PR description. |
peterxcli
left a comment
There was a problem hiding this comment.
+1 LGTM. @xalestar if possible, could you explore whether we can add a class that parses the dbKey into a structured open key record, and stores some info that can be used easily? For example, key = new OpenKey(dbKey), key.isUpload(), key.getClientId().
Thanks @peterxcli! Yes, I'll look into an OpenKey parser. Should I do it in this PR, or in a separate PR after this one is merged? |
separate is good, thank you! |
|
Thanks @xalestar @F64116045 @adoroszlai! |
What changes were proposed in this pull request?
ozone admin om list-open-filesfails withNumberFormatExceptionwhen the listed range contains an open S3 multipart upload.OmMetadataManagerImpl.listOpenFilesparses the last segment of every open key as a client ID, but the open key thatS3InitiateMultipartUploadRequestwrites for an upload ends with the upload ID instead. The exception is not anIOException, so the client sees aRemoteExceptionand retries, and the whole listing fails.This change detects an upload row by its key with the existing
OMMultipartUploadUtils.getUploadIdFromDbKeyand lists it with client ID 0, which no real client has. The check is key based rather than based on theisMultipartKeyflag, 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 withtotalOpenKeyCountand 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
testListOpenFilesWithMultipartUploadtoTestOmMetadataManager, for every bucket layout, with and without a continuation token. It lists a plain open key, an upload row without theisMultipartKeyflag, and the open key of a part being written.mvn test -pl hadoop-ozone/ozone-manager -Dtest=TestOmMetadataManager: 33 tests pass.OmMetadataManagerImplreverted, the new test fails for all 3 bucket layouts withNumberFormatException.mvn checkstyle:check -pl hadoop-ozone/ozone-manager: clean.