Skip to content

HDDS-17251. List open multipart uploads in ListOpenFiles - #11739

Merged
peterxcli merged 2 commits into
apache:masterfrom
xalestar:HDDS-17251
Oct 25, 2026
Merged

peterxcli merged 2 commits into
apache:masterfrom
xalestar:HDDS-17251

Conversation

@xalestar

@xalestar xalestar commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

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.
  • Fork CI: https://github.com/xalestar/ozone/actions/runs/40111938707

@github-actions github-actions Bot added the om label Oct 24, 2026
@adoroszlai

Copy link
Copy Markdown
Contributor

Thanks @xalestar for the patch. Please enable workflows in your fork.

@xalestar
xalestar marked this pull request as ready for review October 24, 2026 14:57

@F64116045 F64116045 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @xalestar, the fix looks good. Just a minor comment

Btw, it would be nice to attach the fork CI link to the PR description.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, extended the comment to state that client ID 0 means the upload has no client ID.

@xalestar

Copy link
Copy Markdown
Contributor Author

Thanks @adoroszlai, enabled. The fork CI link is now in the PR description.

@peterxcli peterxcli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+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().

@F64116045 F64116045 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the fix, looks good +1!

@xalestar

Copy link
Copy Markdown
Contributor Author

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

@peterxcli

Copy link
Copy Markdown
Member

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!

@peterxcli
peterxcli merged commit baeceb9 into apache:master Oct 25, 2026
57 of 58 checks passed
@peterxcli

Copy link
Copy Markdown
Member

Thanks @xalestar @F64116045 @adoroszlai!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants