Presto: Auto-discover Cassandra protocol version

Created on 21 Feb 2019  路  6Comments  路  Source: prestosql/presto

Currently io.prestosql.plugin.cassandra.CassandraClientConfig#protocolVersion defaults to V3.
We should automatically select protocol version based on the Cassandra server we're connecting to.

enhancement

Most helpful comment

In general you don't have to set the protocol version. When unset, driver will negotiate the highest protocol version supported by both driver and the server.

See https://github.com/datastax/java-driver/blob/3.x/driver-core/src/main/java/com/datastax/driver/core/Cluster.java#L1648

You just need to make sure protocol options in configuration does not have initial protocol version set.

All 6 comments

fyi: We can get the protocol version using native cassandra session.

select native_protocol_version from system.local;
 native_protocol_version
-------------------------
                       4

https://docs.datastax.com/en/cql/3.3/cql/cql_using/useQuerySystem.html

Or,

ProtocolVersion myCurrentVersion = cluster.getConfiguration()
    .getProtocolOptions()
    .getProtocolVersionEnum();

https://docs.datastax.com/en/developer/java-driver/2.1/manual/native_protocol/

cc @haaawk

In general you don't have to set the protocol version. When unset, driver will negotiate the highest protocol version supported by both driver and the server.

See https://github.com/datastax/java-driver/blob/3.x/driver-core/src/main/java/com/datastax/driver/core/Cluster.java#L1648

You just need to make sure protocol options in configuration does not have initial protocol version set.

https://github.com/prestosql/presto/issues/587 is caused by default protocol version V3. I'll address this issue.

We can close this issue now.

Thanks @ebyhr

Done in https://github.com/prestosql/presto/pull/596 (311).

Was this page helpful?
0 / 5 - 0 ratings