siddhantsangwan commented on code in PR #4227:
URL: https://github.com/apache/ozone/pull/4227#discussion_r1100137752
##########
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:
Yeah you are right. The advantage of sorting is that we'll prefer
replicating the highest sequence id first. Actually I'm not sure why we
shuffle. What do you think? @adoroszlai
--
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]