Serializer protocol version is changed after init, causing current active connections to fail


Currently the Serializer instance is a singleton shared by every connection and the Control Connection. The control connection changes the protocol version on the Serializer whenever it is attempting to connect (even after init). Also, the connection itself sets the protocol version on the Serializer with the version of the first response that it receives.

This can cause open connections to suddenly change the protocol version they are using to send requests to the node and the node will reply back with:

Cassandra.ProtocolErrorException: Invalid message version. Got 3/v3 but previous messages on this connection had version 4/v4

This scenario can be set up by creating a C* 3.11 cluster and later adding a C* 2.1 node.

Things to change:
1. Prevent the CC from changing the protocol version after init
2. Prevent connections from changing the serializer protocol version. Each connection should have its own version field because on connection startup the connection will be closed if the requested protocol version is not supported. This means that even with a version field per connection, we know that every active connection will use the same version.






Joao Reis

Fix versions