HDDS-16224. Wait for a replica with the container and block before reading in TestFailureHandlingByClient - #11065
Open
rich7420 wants to merge 2 commits into
Open
HDDS-16224. Wait for a replica with the container and block before reading in TestFailureHandlingByClient#11065rich7420 wants to merge 2 commits into
rich7420 wants to merge 2 commits into
Conversation
…andlingByClient testBlockCountOnFailures read each block's container from a fixed pipeline index (block1DNs.get(2) / block2DNs.get(0)). The second block is written to a fresh pipeline allocated after the injected DN failure and commits on a majority of its replicas, so the indexed node may be the lagging replica that has not yet applied the create-container transaction: getContainer(id) returns null and the cast to KeyValueContainer NPEs (testBlockWritesWithDnFailures:220 -> testBlockCountOnFailures:297). Use ClusterContainersUtil.getContainerByID, which returns the container from whichever datanode already has it, instead of a fixed pipeline index.
Contributor
Author
|
cc @ChenSammi |
chihsuan
reviewed
Aug 22, 2026
chihsuan
left a comment
Contributor
There was a problem hiding this comment.
Thanks, @rich7420. Overall, the change looks good. I noticed that the PR title mentions waiting, while the patch searches for a replica where the container is already available.
I suggest using GenericTestUtils.waitFor until both the container and target block are available on the same replica to match PR title, or simplifying the title to something like “Fix intermittent failure in TestFailureHandlingByClient.”
It would also be helpful if the PR description explained the failure and how this change fixes it. Thanks!
…r and block Read from any replica that has both the container and the target block applied (polling), instead of a fixed replica or one chosen only for having the container. A lagging Ratis follower can hold the container without the block, which is the source of the intermittent failure.
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
TestFailureHandlingByClient.testBlockWritesWithDnFailuresintermittently failed while reading a block back from a datanode container replica.Failure. After the key is written and the pipeline is shut down, the test read the two blocks'
KeyValueContainerDatafrom a fixed datanode (a specific pipeline index). With RATIS/THREE and majority commit, that fixed node can be a lagging follower that has not yet applied the container (or has the container but not the target block), so:getContainer(containerId)returnednull→ NPE, orblockData.getChunks()or a chunk-count assertion mismatch.Fix. Read from a replica that has both the container and the target block applied, polling all datanodes with
GenericTestUtils.waitForuntil one is ready. This removes the dependency on a particular replica's apply progress, which is the source of the flakiness. No production code changes; test-only.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16224
How was this patch tested?
mvn -pl :ozone-integration-test test -Dtest='TestFailureHandlingByClient#testBlockWritesWithDnFailures'— passes locally.