Skip to content

HDDS-16482. Fix flaky assertion in TestBlockDataStreamOutput - #11263

Merged
adoroszlai merged 2 commits into
apache:masterfrom
andyhuangdev:HDDS-16482
Sep 19, 2026
Merged

adoroszlai merged 2 commits into
apache:masterfrom
andyhuangdev:HDDS-16482

Conversation

@andyhuangdev

@andyhuangdev andyhuangdev commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

TestBlockDataStreamOutput.closeAfterWriteFailureThrows checks the injected failure message in the exception thrown by close().

Depending on thread scheduling, the failure is wrapped differently, and the outer exception message may not contain the injected message.

This change verifies the root cause type and message while retaining the assertion that close() throws IOException. It removes the unreachable branch and updates the comment to explain the asynchronous exception wrapping.

What is the link to the Apache JIRA

HDDS-16482

How was this patch tested?

Repeated closeAfterWriteFailureThrows in IntelliJ IDEA using "N times" set to 100 across multiple runs. All runs passed without failures.

Verify the root cause of the IOException from close() instead of relying on exception wrapping that varies with thread scheduling.
@andyhuangdev

Copy link
Copy Markdown
Contributor Author

cc @chungen0126 @Russole

@chihsuan chihsuan 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 @andyhuangdev +1, LGTM.

If you get a chance, could you run the flaky-test-check workflow on your fork and link the run here? That helps confirm it holds on CI too. 🙂

@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 @andyhuangdev.
LGTM.

Just to confirm in the description

The remaining branch contains a no-op assertion; correcting it exposes the intermittent failure.

Was the no-op assertion already fixed in HDDS-16084, with this PR fixing the flakiness exposed by that change?

@andyhuangdev

andyhuangdev commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @andyhuangdev +1, LGTM.

If you get a chance, could you run the flaky-test-check workflow on your fork and link the run here? That helps confirm it holds on CI too. 🙂

Ran flaky-test-check on this branch for TestBlockDataStreamOutput#closeAfterWriteFailureThrows with 10 splits × 10 iterations on Java 25. All 100 iterations passed: https://github.com/andyhuangdev/ozone/actions/runs/35450918876

@andyhuangdev

Copy link
Copy Markdown
Contributor Author

Thanks @andyhuangdev. LGTM.

Just to confirm in the description

The remaining branch contains a no-op assertion; correcting it exposes the intermittent failure.

Was the no-op assertion already fixed in HDDS-16084, with this PR fixing the flakiness exposed by that change?

Yes, that's correct. HDDS-16084 (#11056) already fixed the no-op assertion. This PR addresses the flakiness exposed by that fix by checking the root cause type and message, while retaining the assertion that close() throws IOException. It also removes the unreachable CompletionException branch.

@Russole Russole 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 @andyhuangdev for working on this. LGTM!

@adoroszlai
adoroszlai merged commit cc12592 into apache:master Sep 19, 2026
28 of 31 checks passed
@adoroszlai

Copy link
Copy Markdown
Contributor

Thanks @andyhuangdev for the patch, @chihsuan, @F64116045, @Russole for the review.

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.

5 participants