CASSANDRA-10145 allows the client to send the keyspace name in QUERY, PREPARE, and BATCH messages as of v5 (when there is a current keyspace).
The driver should leverage this feature and eventually (after v4 support is dropped) this will allow us to simplify session management in the client. We'd no longer need different connection pools for different sessions since connections will no longer have keyspaces bound to them. It would be great if part of this fix included logic to avoid creating extra pools if we're speaking v5 or later.
QUERY message changes:
flag 0x80 means a keyspace name is being provided in the message; if set, add the keyspace [string] after timestamp
PREPARE message changes:
A flags field has been added such that the message format is now:
<query><flags>[<keyspace>]
flag 0x01 means a keyspace name is being provided in the message.
BATCH message changes:
Pretty much the same as QUERY message; flag 0x80 means there's a keyspace [string] after the timestamp.
See the native_protocol_v5.spec file in the patch in CASSANDRA-10145 for details.
Thanks for posting it !