You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "sodonnel (via GitHub)" <gi...@apache.org> on 2023/04/20 18:19:06 UTC

[GitHub] [ozone] sodonnel commented on a diff in pull request #4599: HDDS-8416. ReplicationManager: RatisUnderReplication handler should filter sources by highest BCSID

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


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/RatisUnderReplicationHandler.java:
##########
@@ -217,7 +217,15 @@ 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(ContainerReplica::getSequenceId).max(Long::compareTo).orElse(0L);

Review Comment:
   Probably is worth adding this "just incase". It might even be better to change the map step to return zero if getSequenceId returns null. That way, if for some strange reason all replicas don't have a sequenceID we just use any of them, rather than filter all of them out.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org