From 6584965c93720ca7d19a4b55be4d3a411d4195f8 Mon Sep 17 00:00:00 2001 From: Arnab Nandy Date: Sat, 1 Aug 2026 15:20:14 +0530 Subject: [PATCH] Skip DSE versions during protocol negotiation Signed-off-by: Arnab Nandy --- changelog/README.md | 1 + .../internal/core/DefaultProtocolVersionRegistry.java | 5 ++++- .../core/DefaultProtocolVersionRegistryTest.java | 5 +++++ manual/core/configuration/reference/README.rst | 2 +- manual/core/native_protocol/README.md | 11 ++++++----- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/changelog/README.md b/changelog/README.md index b90979e2e71..29a6c1aea45 100644 --- a/changelog/README.md +++ b/changelog/README.md @@ -23,6 +23,7 @@ under the License. ### 4.19.2 +- [improvement] Skip DSE protocol versions during automatic protocol negotiation - [bug] CASSJAVA-116: Retry or Speculative Execution with RequestIdGenerator throws "Duplicate Key" ### 4.19.1 diff --git a/core/src/main/java/com/datastax/oss/driver/internal/core/DefaultProtocolVersionRegistry.java b/core/src/main/java/com/datastax/oss/driver/internal/core/DefaultProtocolVersionRegistry.java index 80850e8e95a..9dacdcd6779 100644 --- a/core/src/main/java/com/datastax/oss/driver/internal/core/DefaultProtocolVersionRegistry.java +++ b/core/src/main/java/com/datastax/oss/driver/internal/core/DefaultProtocolVersionRegistry.java @@ -87,7 +87,10 @@ public ProtocolVersion fromName(String name) { @Override public ProtocolVersion highestNonBeta() { - ProtocolVersion highest = allVersions.get(allVersions.size() - 1); + // DSE protocol versions remain available when forced, but are never useful when negotiating + // with ScyllaDB. + DefaultProtocolVersion[] ossVersions = DefaultProtocolVersion.values(); + ProtocolVersion highest = ossVersions[ossVersions.length - 1]; if (!highest.isBeta()) { return highest; } else { diff --git a/core/src/test/java/com/datastax/oss/driver/internal/core/DefaultProtocolVersionRegistryTest.java b/core/src/test/java/com/datastax/oss/driver/internal/core/DefaultProtocolVersionRegistryTest.java index 1d7cc65d1f2..4e3abaa3a9e 100644 --- a/core/src/test/java/com/datastax/oss/driver/internal/core/DefaultProtocolVersionRegistryTest.java +++ b/core/src/test/java/com/datastax/oss/driver/internal/core/DefaultProtocolVersionRegistryTest.java @@ -65,6 +65,11 @@ public void should_fail_to_find_version_by_name_different_case() { .isInstanceOf(IllegalArgumentException.class); } + @Test + public void should_pick_highest_non_beta_oss_version_for_negotiation() { + assertThat(registry.highestNonBeta()).isEqualTo(V5); + } + @Test public void should_downgrade_if_lower_version_available() { Optional downgraded = registry.downgrade(V4); diff --git a/manual/core/configuration/reference/README.rst b/manual/core/configuration/reference/README.rst index c2e3f609377..6baee3e4366 100644 --- a/manual/core/configuration/reference/README.rst +++ b/manual/core/configuration/reference/README.rst @@ -24,7 +24,7 @@ It is packaged in the ``java-driver-core`` JAR artifact, and used at runtime to values for all configuration options (in the sources, it can be found under ``core/src/main/resources``). -See the `configuration page <../>`_ for more explanations. +See the :doc:`configuration page <../>` for more explanations. .. raw:: html diff --git a/manual/core/native_protocol/README.md b/manual/core/native_protocol/README.md index 42146e63f42..d4ab96e3c63 100644 --- a/manual/core/native_protocol/README.md +++ b/manual/core/native_protocol/README.md @@ -52,17 +52,18 @@ first node the driver connects to: *(1) for previous driver versions, see the [3.x documentation][driver3]* -Since version 4.5.0, the driver can also use DSE protocols when all nodes are running a version of -DSE. The table below shows the protocol matrix for these cases: +The driver can also use DSE protocols when they are explicitly configured. Automatic negotiation +only probes standard Cassandra protocol versions, to avoid attempting DSE protocols against +ScyllaDB. The table below shows the automatically negotiated versions for DSE: | DSE version | Negotiated protocol version with driver 4 | |---------------------|-------------------------------------------------| | 4.7/4.8 | v3 | | 5.0 | v4 | -| 5.1 | DSE_V1 ² | -| 6.0/6.7/6.8 | DSE_V2 ² | +| 5.1 | v4 | +| 6.0/6.7/6.8 | v4 | -*(2) DSE Protocols are chosen before other Cassandra native protocols.* +To use DSE-specific features, force `DSE_V1` or `DSE_V2` with `advanced.protocol.version`. ### Controlling the protocol version