Skip to content

HDDS-17027. Intermittent failure in TestReplicationSupervisor#testReconciliationTaskMetrics - #11542

Merged
smengcl merged 1 commit into
apache:masterfrom
smengcl:HDDS-17027-flaky
Oct 20, 2026
Merged

smengcl merged 1 commit into
apache:masterfrom
smengcl:HDDS-17027-flaky

Conversation

@smengcl

@smengcl smengcl commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Generated-by: Claude Code (Opus 5.5)

What changes were proposed in this pull request?

TestReplicationSupervisor#testReconciliationTaskMetrics fails intermittently on assertTrue(getReplicationRequestTotalTime(...) > 0).

ReplicationSupervisor records task latency with Time.monotonicNow(), which has millisecond resolution. The reconciliation tasks in this test call a Mockito ContainerController whose reconcileContainer does nothing, so all tasks can complete within the same millisecond and the total latency stays 0.

This patch stubs reconcileContainer in the test to sleep 1 ms, so each successful task takes at least 1 ms and the total and average latency are always positive.

What is the link to the Apache JIRA

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

How was this patch tested?

  • mvn -pl :hdds-container-service test -Dtest=TestReplicationSupervisor: 54/54 passed locally.
  • The fix is deterministic by construction: a 1 ms sleep guarantees a difference of at least 1 between the two monotonicNow() readings around each successful task.
  • 10x10 flaky-test-check on this branch: passed 100/100

🤖 Generated with Claude Code

…onciliationTaskMetrics

ReplicationSupervisor records task latency with Time.monotonicNow(), which has millisecond resolution. The reconciliation tasks in this test call a Mockito ContainerController that does nothing, so all tasks can complete within the same millisecond, leaving the total latency at 0 and failing the "> 0" assertions.

Stub reconcileContainer to sleep 1 ms so each successful task takes at least 1 ms and the total and average latency are always positive.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Copilot AI lite review requested due to automatic review settings October 14, 2026 22:12
@smengcl
smengcl marked this pull request as ready for review October 14, 2026 22:18

Copilot AI 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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

1 open finding
What changed in this PR

Stabilizes TestReplicationSupervisor#testReconciliationTaskMetrics by ensuring reconciliation tasks take at least 1ms so latency metrics recorded with millisecond resolution are non-zero.

Changes:

  • Stub ContainerController#reconcileContainer to sleep briefly during the test.
  • Add an explanatory comment about millisecond-resolution latency metrics.
File Description
hadoop-hdds/​container-service/​src/​test/​java/​org/​apache/​hadoop/​ozone/​container/​replication/​TestReplicationSupervisor.java Adds a Mockito stub that injects a minimal delay to avoid zero-latency metric readings

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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

LGTM!

@smengcl
smengcl merged commit f276198 into apache:master Oct 20, 2026
60 of 61 checks passed
@smengcl

smengcl commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @rich7420 @Russole for the reviews.

@smengcl
smengcl deleted the HDDS-17027-flaky branch October 20, 2026 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants