sodonnel commented on code in PR #4599:
URL: https://github.com/apache/ozone/pull/4599#discussion_r1173566475
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/RatisUnderReplicationHandler.java:
##########
@@ -217,7 +217,18 @@ private List<DatanodeDetails> getSources(
}
})
.filter(r -> !pendingDeletion.contains(r.getDatanodeDetails()))
- .sorted((r1, r2) -> r2.getSequenceId().compareTo(r1.getSequenceId()))
+ .collect(Collectors.toList());
+
+ // We should replicate only the max available sequence ID, as replicas with
+ // earlier sequence IDs may be stale copies.
+ long maxSequenceId = availableSources.stream()
+ .map(r -> {
+ Long seqId = r.getSequenceId();
+ return seqId == null ? Long.valueOf(0L) : seqId;
+ }).max(Long::compareTo).orElse(0L);
+
+ return availableSources.stream()
+ .filter(r -> r.getSequenceId() == maxSequenceId)
Review Comment:
Ah, ok. Thanks for the suggested change. I have implemented that and pushed
a new commit.
--
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]