You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by GitBox <gi...@apache.org> on 2022/08/09 16:59:42 UTC

[GitHub] [ratis] szetszwo commented on a diff in pull request #706: RATIS-1663. Record call id for board casting a heartbeat.

szetszwo commented on code in PR #706:
URL: https://github.com/apache/ratis/pull/706#discussion_r941585168


##########
ratis-common/src/main/java/org/apache/ratis/rpc/CallId.java:
##########
@@ -27,6 +28,17 @@
 public final class CallId {
   private static final AtomicLong CALL_ID_COUNTER = new AtomicLong();
 
+  private static final Comparator<Long> COMPARATOR = (left, right) -> {
+    final long diff = left - right;
+    // check diff < Long.MAX_VALUE/2 for the possibility of numerical overflow.
+    return diff == 0? 0: diff > 0 && diff < Long.MAX_VALUE/2? 1: -1;

Review Comment:
   It generates call IDs in a different way -- this only allows >=0 values but GrpcLogAppender allows +/- values.



-- 
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@ratis.apache.org

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