sodonnel commented on code in PR #4227:
URL: https://github.com/apache/ozone/pull/4227#discussion_r1101401205


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/RatisUnderReplicationHandler.java:
##########
@@ -175,14 +189,21 @@ private List<DatanodeDetails> getSources(
       }
     }
 
+    Predicate<ContainerReplica> predicate;
+    if (replicaCount.getHealthyReplicaCount() == 0) {
+      predicate = replica -> replica.getState() == State.UNHEALTHY;
+    } else {
+      predicate = replica -> replica.getState() == State.CLOSED ||
+          replica.getState() == State.QUASI_CLOSED;
+    }
+
     /*
-     * Return healthy datanodes that have closed/quasi-closed replicas and
-     * are not pending replica deletion. Sorted in descending order of
-     * sequence id.
+     * Return healthy datanodes which have a replica that satisfies the
+     * predicate and is not pending replica deletion. Sorted in descending
+     * order of sequence id.

Review Comment:
   Probably the replica we will select at the source will end up based on the 
load on the source host. Eg sort by "pending Replications" on the source hosts, 
and use the one with least pending commands. This is something we can change 
later when we get the load limiting stuff in.



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