Repository navigation
HDDS-16934. Fix intermittent failure in TestSCMNodeManager#testDatanodeFinalizedCounterExcludesNonHealthyNodes - #11482
Merged
Conversation
…deFinalizedCounterExcludesNonHealthyNodes In the DEAD case the last heartbeat of the baseline node was followed by Thread.sleep(3000), which equals the stale node interval. If the node health check ran between the end of the sleep and the assertions, the baseline node was marked STALE and the healthy datanode count was 0 instead of 1. Replace the fixed sleeps with GenericTestUtils.waitFor that keeps heartbeating the baseline node until the other node reaches the expected state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The test-only fix addresses the intermittent failure and has been validated by repeated runs.
0 open findings
What changed in this PR
Fixes an intermittent SCM node health test failure by replacing timing-sensitive sleeps with polling while keeping the baseline node heartbeating.
Changes:
- Uses
GenericTestUtils.waitForfor state transitions. - Adds timeout handling for asynchronous waits.
| File | Description |
|---|---|
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java |
Makes stale/dead node transition testing deterministic. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
smengcl
marked this pull request as ready for review
October 12, 2026 06:45
Contributor
|
Merged. Thanks @smengcl |
Contributor
Author
|
Thanks @jojochuang for the review. |
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.
Generated-by: Claude Code (Opus 5.5)
What changes were proposed in this pull request?
TestSCMNodeManager#testDatanodeFinalizedCounterExcludesNonHealthyNodesfails intermittently for the DEAD parameter:The test sets the stale node interval to 3s and drives node state with fixed
Thread.sleepcalls. In the DEAD case the last heartbeat of the baseline node is followed byThread.sleep(3000), so that heartbeat is at least 3s old when the assertions run. If the node health check (100ms period) fires between the end of the sleep and the assertions, the baseline node itself is marked STALE and the healthy datanode count is 0 instead of 1.This PR replaces the fixed sleeps with
GenericTestUtils.waitForthat keeps heartbeating the baseline node until the other node reaches the expected state, the same pattern other tests in this class already use. The baseline heartbeat is then at most about 100ms old at assertion time, far below the 3s stale node interval. Test only change.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16934
How was this patch tested?
IN_SERVICE-STALE.mvn -pl :hdds-server-scm test -Dtest='TestSCMNodeManager#testDatanodeFinalizedCounterExcludesNonHealthyNodes' -DskipShade -DskipRecon -DskipDocs🤖 Generated with Claude Code