bereng commented on code in PR #1891:
URL: https://github.com/apache/cassandra/pull/1891#discussion_r1108340945


##########
src/java/org/apache/cassandra/cql3/QueryOptions.java:
##########
@@ -53,6 +54,10 @@
 
     public static final CBCodec<QueryOptions> codec = new Codec();
 
+    private static final int UNSET_NOWINSEC = Integer.MIN_VALUE;
+    // Guava uint counterpart to the above for serialization purposes. This 
imposes a year 2186 max value
+    private static final int UNSET_NOWINSEC_GUAVA_UINT = 
UnsignedInteger.MAX_VALUE.intValue() - 1;

Review Comment:
   MAX and MIN are often used in the code as sentinel values. You don't want 
sbdy passing you `UnsignedInteger.MAX_VALUE` to signal some special condition 
and accidentally mapping that to `UNSET_NOWINSEC`. So the -1 is to avoid that 
collision.
   
   `MAX_VALUE-1` imo is a 'better' sentinel value, if such a thing can be said 
about any random value, because it's far less likely to collide and allows 
consumers to use the 'classic' MAX sentinel values they are used to.
   
   But no other hard reasons as nowInSec won't be around MAX values until year 
2106.



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