rich7420 commented on code in PR #11182:
URL: https://github.com/apache/ozone/pull/11182#discussion_r3939574992


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/reconciliation/ReconcileContainerEventHandler.java:
##########
@@ -67,21 +73,46 @@ public void onMessage(ContainerID containerID, 
EventPublisher publisher) {
     }
 
     try {
-      // TODO HDDS-10714 restriction peer and target nodes based on node 
status.
-      Set<DatanodeDetails> allReplicaNodes = 
containerManager.getContainerReplicas(containerID)
-          .stream()
-          .map(ContainerReplica::getDatanodeDetails)
-          .collect(Collectors.toSet());
+      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()) {

Review Comment:
   gooood catch! thanks for the suggestion



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to