You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2020/10/27 16:30:43 UTC

[GitHub] [cassandra] belliottsmith commented on a change in pull request #786: CASSANDRA-16103: Invalid serialized size for responses

belliottsmith commented on a change in pull request #786:
URL: https://github.com/apache/cassandra/pull/786#discussion_r512844657



##########
File path: src/java/org/apache/cassandra/net/Message.java
##########
@@ -367,8 +368,13 @@ private Header(long id, Verb verb, InetAddressAndPort from, long createdAtNanos,
             this.id = id;
             this.verb = verb;
             this.from = from;
-            this.createdAtNanos = createdAtNanos;
             this.expiresAtNanos = expiresAtNanos;
+            if (verb.isResponse())
+                // Correct createdAtNanos to enforce the contraint, createdAtNanos <= expiresAtNanos
+                this.createdAtNanos = Math.min(createdAtNanos, expiresAtNanos);

Review comment:
       I'm unconvinced by this change too - it's accepted and acceptable for rare edge cases to spent 9 bytes encoding a negative value. The cost of those 9 bytes is negligible, and not worth trying to optimise in any way.




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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org