Skip to content

HDDS-11128. Isolate maintenance and decommission test invocations - #11010

Draft
smengcl wants to merge 4 commits into
apache:masterfrom
smengcl:HDDS-11128
Draft

HDDS-11128. Isolate maintenance and decommission test invocations#11010
smengcl wants to merge 4 commits into
apache:masterfrom
smengcl:HDDS-11128

Conversation

@smengcl

@smengcl smengcl commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Generated-by: Claude Code (Opus 4.8)
Generated-by: Codex (GPT-5)

What changes were proposed in this pull request?

TestReconAndAdminContainerCLI#testNodesInDecommissionOrMaintenance intermittently timed out after
a decommission or maintenance step (HDDS-11128).

The original patch assumed that the test observed a transient replica count while SCM was still
processing replication. A 10 by 10 stress run of that patch showed a different race. The maintenance
invocation recommissions its nodes but can return while its fourth replica still exists. The following
decommission invocation then selects a node from the original pipeline while SCM is still removing the
excess replica. If SCM deletes the replica on the node that just started decommissioning, decommission
correctly completes without creating another copy, and the test waits for a replica count that SCM does
not need to reach.

This change isolates the two parameterized invocations:

  • It waits for a healthy three replica baseline before each invocation.
  • It selects nodes from SCM's current container replicas instead of the original pipeline.
  • After recommission, it waits for SCM to restore the healthy three replica baseline.
  • waitForStableReplicaCount now requires the exact count, no pending operations, and current
    ReplicationManager health HEALTHY. An empty pending operation list alone does not prove that
    ReplicationManager has evaluated the latest replica and node state.

The test remains tagged @Flaky("HDDS-11128") while the fix is validated under repeated CI runs.

What is the link to the Apache JIRA

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

How was this patch tested?

The pre fix 10 by 10 run had 23 failed iterations. Twenty two failures were timeouts in parameter
invocation [2], the decommission case. The remaining failure occurred during setup when Recon briefly
closed its container metadata DB during asynchronous task reinitialization. That setup failure is
independent and is not addressed by this patch.

… waits in TestReconAndAdminContainerCLI

testNodesInDecommissionOrMaintenance intermittently times out at
OzoneTestHelper.waitForReplicaCount while waiting for a decommission-
triggered replica copy (3 -> 4 for the first node, 4 -> 5 for the second)
to be reflected in SCM. The shared waitForReplicaCount helper used a fixed
30s budget for all 14 callers; HDDS-10582 only reduced its poll interval
(1000ms -> 200ms) and kept the 30s total, so under a loaded CI runner the
replica copy is not always observed in time and the test flakes.

Add a 4-arg waitForReplicaCount overload that accepts a timeout, leaving the
existing 3-arg method delegating with the same 30s default (no behavior
change for the other callers). The decommission/maintenance replica-copy
waits in TestReconAndAdminContainerCLI now use a 120s budget, matching the
larger timeouts adopted elsewhere for the same class of replication waits.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 13, 2026 05:50

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.

Pull request overview

This PR reduces flakiness in Recon/admin container CLI integration coverage by allowing callers of the shared OzoneTestHelper.waitForReplicaCount helper to specify a larger timeout, and then applying that higher timeout to the decommission/maintenance replica-copy waits that intermittently time out in CI.

Changes:

  • Added a 4-argument waitForReplicaCount(..., timeoutMillis) overload in OzoneTestHelper, keeping the existing 3-arg method as a 30s-default wrapper.
  • Updated TestReconAndAdminContainerCLI#testNodesInDecommissionOrMaintenance to use a 120s timeout when waiting for decommission/maintenance-triggered replica copies to be reflected in SCM.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/OzoneTestHelper.java Introduces a timeout-parameter overload for waitForReplicaCount, preserving the original default behavior.
hadoop-ozone/integration-test-recon/src/test/java/org/apache/hadoop/ozone/recon/TestReconAndAdminContainerCLI.java Uses a larger, named timeout constant for the decommission/maintenance replica-copy waits to reduce test flakiness.

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

smengcl and others added 2 commits August 12, 2026 22:58
…ReplicaCount Javadoc link

The happy path returns as soon as the copy lands, so the timeout only
matters on a genuine failure; 120s was more than needed and, because this
@flaky test is rerun on failure in the flaky split, an oversized budget
multiplies wasted CI time on a real break. 60s (double the previous 30s)
gives comfortable headroom for the tail latency while keeping the failing
path bounded.

Also qualify the OzoneTestHelper#waitForReplicaCount(long, int, MiniOzoneCluster)
Javadoc link, which became ambiguous once the timeout overload was added
(flagged by review, avoids doclint resolution warnings).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…lica count

testNodesInDecommissionOrMaintenance waited on a bare replica-count
equality (countReplicas(...) == N) after each decommission/maintenance
step. During decommission SCM is actively adding (and re-evaluating)
replicas, so the count passes through the expected value transiently; a
fixed-value poll can sample the wrong instant and time out. HDDS-10582
only shrank the poll interval (1000ms -> 200ms) to narrow that window, so
the flake recurred (HDDS-11128).

Add OzoneTestHelper.waitForStableReplicaCount, which returns only once
replication has quiesced (ReplicationManager has no pending add/delete ops
for the container) AND the count equals N, so the assertion is on a settled
state rather than a transient one. It uses the same 30s budget as
waitForReplicaCount; the elevated timeout is no longer needed because the
call runs right after the DECOMMISSIONED/IN_MAINTENANCE gate, which already
requires the new replica to exist, so the settle returns almost immediately.
The existing waitForReplicaCount is left untouched for its other callers.
The test remains @flaky("HDDS-11128") because no wait can prove
non-flakiness.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@smengcl smengcl changed the title HDDS-11128. Increase timeout for decommission-triggered replica-count waits in TestReconAndAdminContainerCLI HDDS-11128. Wait for replication to settle instead of a transient replica count Aug 13, 2026
@smengcl
smengcl requested a balanced review from Copilot August 13, 2026 07:43

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (1)

hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/OzoneTestHelper.java:482

  • An empty pending-op list is only a snapshot; it does not mean ReplicationManager has evaluated the latest node/replica state. This test configures RM to scan every 1 second, while this predicate polls every 200 ms, so it can accept an already-present expected count before the next scan schedules an add/delete and reproduce the same transient-state race. ReplicationManager.processAll() is public specifically for tests and synchronized with its monitor thread; run a pass before checking the pending operations so the observed emptiness reflects the current state.
    GenericTestUtils.waitFor(() ->
        replicationManager.getPendingReplicationOps(cid).isEmpty() && countReplicas(containerID, cluster) == count,
        200, 30000);

The maintenance invocation can return with an excess replica before SCM finishes over replication cleanup. The following decommission invocation can select that replica, then cleanup deletes it and decommission completes without creating another copy. The test then waits for a replica count that SCM does not need to reach.

Wait for a healthy three replica baseline before and after each invocation, and select nodes from the current SCM replica set instead of the original pipeline. Also require current healthy replication state in the stable replica count helper so an empty pending operation list alone does not establish quiescence.
@smengcl smengcl changed the title HDDS-11128. Wait for replication to settle instead of a transient replica count HDDS-11128. Isolate maintenance and decommission test invocations Aug 20, 2026
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.

2 participants