smengcl commented on code in PR #6768:
URL: https://github.com/apache/ozone/pull/6768#discussion_r1628693413


##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientRatis.java:
##########
@@ -152,7 +174,12 @@ public long updateCommitInfosMap(
               (address, index) -> proto.getCommitIndex()))
           .filter(Objects::nonNull);
     }
-    return stream.mapToLong(Long::longValue).min().orElse(0);
+    if (level == ReplicationLevel.ALL_COMMITTED) {
+      return stream.mapToLong(Long::longValue).min().orElse(0);
+    } else {
+      // if majority committed, then find the second large index
+      return 
stream.sorted(Comparator.reverseOrder()).limit(majority).skip(majority - 
1).findFirst().orElse(0L);
+    }

Review Comment:
   We can unify the logic to return the lowest index in commitInfos, right? 



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