Skip to content

HDDS-15213. Use common commit output for stream outputs#10224

Open
peterxcli wants to merge 1 commit intoapache:masterfrom
peterxcli:codex/HDDS-15213-key-commit-output-refactor
Open

HDDS-15213. Use common commit output for stream outputs#10224
peterxcli wants to merge 1 commit intoapache:masterfrom
peterxcli:codex/HDDS-15213-key-commit-output-refactor

Conversation

@peterxcli
Copy link
Copy Markdown
Member

@peterxcli peterxcli commented May 9, 2026

What changes were proposed in this pull request?

Introduce a new KeyCommitOutput interface to unify commit-time behaviors for key output implementations in the Ozone client, and refactors related classes to use this interface. It also simplifies the handling of pre-commit hooks and improves multipart upload handling, especially for EC mpu.

Testing:

  • Added new tests for multipart uploads with the STANDARD_IA storage class, including verification of content MD5 handling. which originally would fail on master

the InstanceOf check refactor is similar to #9370

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-15213

How was this patch tested?

IT/UT

Signed-off-by: peterxcli <peterxcli@gmail.com>
Comment on lines +146 to +164
public void testPartUploadWithStandardIAAndContentMD5() throws Exception {
when(headers.getHeaderString(STORAGE_CLASS_HEADER))
.thenReturn(S3StorageType.STANDARD_IA.name(), (String)null);
String content = "Multipart Upload Part";
byte[] contentBytes = content.getBytes(StandardCharsets.UTF_8);
byte[] md5Bytes = MessageDigest.getInstance("MD5").digest(contentBytes);
String md5Base64 = Base64.getEncoder().encodeToString(md5Bytes);
when(headers.getHeaderString("Content-MD5")).thenReturn(md5Base64);

String keyName = UUID.randomUUID().toString();
String uploadID = initiateMultipartUpload(rest, OzoneConsts.S3_BUCKET, keyName);

try (Response response = put(rest, OzoneConsts.S3_BUCKET, keyName, 1,
uploadID, content)) {
assertNotNull(response.getHeaderString(OzoneConsts.ETAG));
assertEquals(200, response.getStatus());
}
assertContentLength(uploadID, keyName, content.length());
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this test case would fail on master with:

NullPointerException: Cannot invoke
"org.apache.hadoop.ozone.client.io.KeyDataStreamOutput.setPreCommits(java.util.List)"
because the return value of
"OzoneDataStreamOutput.getKeyDataStreamOutput()" is null

at ObjectEndpointStreaming.createMultipartKey(ObjectEndpointStreaming.java:243)

@peterxcli
Copy link
Copy Markdown
Member Author

cc @yandrey321, @hevinhsu

@ivandika3 ivandika3 requested a review from fapifta May 9, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant