Sylvain Lebresne created CASSANDRA-8100:
-------------------------------------------
Summary: Remove payload size from intra-cluster messages
Key: CASSANDRA-8100
URL: https://issues.apache.org/jira/browse/CASSANDRA-8100
Project: Cassandra
Issue Type: Improvement
Reporter: Sylvain Lebresne
Fix For: 3.0
Intra-cluster messages ship with the [size of their
payload|https://github.com/apache/cassandra/blob/8d8fed52242c34b477d0384ba1d1ce3978efbbe8/src/java/org/apache/cassandra/net/MessageOut.java#L118]
before said payload. We mostly don't need it however as deserializers don't
rely on it to know when to stop. The [only reason we need
it|https://github.com/apache/cassandra/blob/8d8fed52242c34b477d0384ba1d1ce3978efbbe8/src/java/org/apache/cassandra/net/MessageIn.java#L86]
is that all responses message use the same {{Verb}} and so in those case we
use the message callback to find out the proper serializer, but in the
(unlikely) case where the callback has expired, we don't know which
deserializer to use and so we use the payload size to skip the payload.
Having to ship the payload size means we need to be able to compute it. Which
means we have to implement the serializedSize for all of your serializer (not a
huge deal but annoying), but more importantly, this makes it impossible to
write a request response truly incrementally (CASSANDRA-8099) since you have to
buffer everything in memory just to compute the serialized size.
So I propose we remove the payload size from messages. Instead, we can assign
specific {{Verb}} to each response type (getting rid of
{{CallbackDeterminedSerializer}}). We can then get rid of all the
serializedSize methods (for upgrade, when we need to generate messages to old
nodes, we could just write the message in a ByteBuffer, write the resulting
size and then write the buffer).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)