From ea95cdaaecb0852887aae5e571ed7e7de3b23268 Mon Sep 17 00:00:00 2001 From: Vlad Zolotarov Date: Tue, 9 Dec 2025 13:29:27 -0500 Subject: [PATCH] transport/server: declare a new "CLIENT_OPTIONS" option as supported Declare support for a 'CLIENT_OPTIONS' startup key. This key is meant to be used by drivers for sending client-specific configurations like request timeouts values, retry policy configuration, etc. The value of this key can be any string in general (according to the CQL binary protocol), however, it's expected to be some structured format, e.g. JSON. Signed-off-by: Vlad Zolotarov --- docs/dev/protocol-extensions.md | 2 ++ transport/server.cc | 3 +++ 2 files changed, 5 insertions(+) diff --git a/docs/dev/protocol-extensions.md b/docs/dev/protocol-extensions.md index 912cf1c68f..f3762ff534 100644 --- a/docs/dev/protocol-extensions.md +++ b/docs/dev/protocol-extensions.md @@ -74,6 +74,8 @@ The keys and values are: as an indicator to which shard client wants to connect. The desired shard number is calculated as: `desired_shard_no = client_port % SCYLLA_NR_SHARDS`. Its value is a decimal representation of type `uint16_t`, by default `19142`. + - `CLIENT_OPTIONS` is a string containing a JSON object representation that + contains CQL Driver configuration, e.g. load balancing policy, retry policy, timeouts, etc. Currently, one `SCYLLA_SHARDING_ALGORITHM` is defined, `biased-token-round-robin`. To apply the algorithm, diff --git a/transport/server.cc b/transport/server.cc index 89f70e6702..a42b058e02 100644 --- a/transport/server.cc +++ b/transport/server.cc @@ -1653,6 +1653,9 @@ std::unique_ptr cql_server::connection::make_supported(int opts.insert({"CQL_VERSION", cql3::query_processor::CQL_VERSION}); opts.insert({"COMPRESSION", "lz4"}); opts.insert({"COMPRESSION", "snappy"}); + // CLIENT_OPTIONS value is a JSON string that can be used to pass client-specific configuration, + // e.g. CQL driver configuration. + opts.insert({"CLIENT_OPTIONS", ""}); if (_server._config.allow_shard_aware_drivers) { opts.insert({"SCYLLA_SHARD", format("{:d}", this_shard_id())}); opts.insert({"SCYLLA_NR_SHARDS", format("{:d}", smp::count)});