From f9d66f88bbc7b5e1ec7ada75d57a5eeaaa3bc2b6 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Wed, 6 Jun 2018 23:34:37 +0300 Subject: [PATCH] transport: advertise the shard serving a connection It is useful for the client driver to know which shard is serving a particular connection, so it can only send requests through that connection which will be served by the same shard, eliminating a hop. Support that by advertising a "SCYLLA_SHARD" option, with a value corresponding to the shard number. Acked-by: Glauber Costa Message-Id: <20180606203437.1198-1-avi@scylladb.com> --- transport/server.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/transport/server.cc b/transport/server.cc index c4233d0644..08516453f3 100644 --- a/transport/server.cc +++ b/transport/server.cc @@ -1195,6 +1195,7 @@ shared_ptr cql_server::connection::make_supported(int16_t opts.insert({"CQL_VERSION", cql3::query_processor::CQL_VERSION}); opts.insert({"COMPRESSION", "lz4"}); opts.insert({"COMPRESSION", "snappy"}); + opts.insert({"SCYLLA_SHARD", sprint("%d", engine().cpu_id())}); auto response = make_shared(stream, cql_binary_opcode::SUPPORTED, tr_state); response->write_string_multimap(opts); return response;