Skip to content

HDDS-10714. Restrict reconciliation requests by datanode status - #11182

Open
rich7420 wants to merge 4 commits into
apache:masterfrom
rich7420:HDDS-10714
Open

HDDS-10714. Restrict reconciliation requests by datanode status#11182
rich7420 wants to merge 4 commits into
apache:masterfrom
rich7420:HDDS-10714

Conversation

@rich7420

@rich7420 rich7420 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

SCM previously sent container reconciliation commands to every datanode with a replica and allowed every replica to be used as a peer, regardless of the datanode's health or operational state.

This change uses NodeManager status when selecting reconciliation participants:

  • Healthy in-service datanodes are command targets and peers.
  • Healthy datanodes that are decommissioning or entering maintenance remain peers, but do not receive commands.
  • Stale, dead, unknown, decommissioned, and in-maintenance datanodes are excluded from both roles.
  • An eligible target still receives a command when no eligible peers are available, so it can generate missing checksum data and scan its local container.
  • Reconciliation is skipped when no eligible target is available.

The existing container and replica eligibility rules are unchanged. Changes to reconciliation status reporting are out of scope.

What is the link to the Apache JIRA

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

How was this patch tested?

https://github.com/rich7420/ozone/actions/runs/33510354889
10 x 10 flaky-test-check for TestReconcileContainerEventHandler — 100/100 passed: https://github.com/rich7420/ozone/actions/runs/33515332863

ReconcileContainerEventHandler sent a reconcile command to every replica and
listed every other replica as a peer, ignoring node status. Restrict
participation using the rules from the Jira: stale, dead, decommissioned, and
in-maintenance nodes are neither peers nor targets; decommissioning and
entering-maintenance nodes can be peers but not targets so their data is
reconciled off before they leave the cluster; healthy, in-service nodes are
both. The handler now looks up each replica's NodeStatus and partitions the
replicas into targets and peers accordingly, and skips a target that has no
eligible peer to reconcile against. Covered by
TestReconcileContainerEventHandler cases for the per-status partition, the
no-eligible-peer skip, and an unknown-status node.

Claude-Session: https://claude.ai/code/session_01FUpCUnmy6JzHPGvwMhyGzq
Copilot AI lite review requested due to automatic review settings September 1, 2026 14:04

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.

Pull request overview

Restricts SCM’s container reconciliation participants based on datanode health/operational status via NodeManager, and updates tests and wiring accordingly.

Changes:

  • Inject NodeManager into ReconcileContainerEventHandler and filter reconciliation targets/peers by NodeStatus.
  • Skip reconciliation when no eligible targets exist; allow “target-only” reconciliation when peers are empty.
  • Extend TestReconcileContainerEventHandler with status-based reconciliation scenarios.

Reviewed changes

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

File Description
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/reconciliation/ReconcileContainerEventHandler.java Adds NodeManager-driven filtering for reconciliation targets/peers and skip behavior.
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManager.java Wires scmNodeManager into the updated reconciliation handler constructor.
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/reconciliation/TestReconcileContainerEventHandler.java Adds/updates tests validating reconciliation behavior across node statuses.

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

Comment on lines +76 to +98
Set<DatanodeDetails> targets = new HashSet<>();
Set<DatanodeDetails> peers = new HashSet<>();
for (ContainerReplica replica : containerManager.getContainerReplicas(containerID)) {
DatanodeDetails datanode = replica.getDatanodeDetails();
final NodeStatus status;
try {
status = nodeManager.getNodeStatus(datanode);
} catch (NodeNotFoundException ex) {
LOG.warn("Skipping datanode {} for reconciliation of container {} since its status is unknown.",
datanode, containerID);
continue;
}
if (!status.isHealthy()) {
continue;
}
// Transitioning nodes remain peers so other replicas can recover any unique data before the node leaves.
if (!status.isDecommissioned() && !status.isInMaintenance()) {
peers.add(datanode);
}
if (status.isInService()) {
targets.add(datanode);
}
}
Comment on lines +100 to +107
LOG.info("Reconcile container event triggered for container {} with targets {} and peers {}",
containerID, targets, peers);

LOG.info("Reconcile container event triggered for container {} with peers {}", containerID, allReplicaNodes);
if (targets.isEmpty()) {
LOG.warn("Skipping reconciliation for container {} since no eligible target datanodes are available.",
containerID);
return;
}
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.

2 participants