mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-31 20:16:43 +00:00
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 <glauber@scylladb.com> Message-Id: <20180606203437.1198-1-avi@scylladb.com>
This commit is contained in:
@@ -1195,6 +1195,7 @@ shared_ptr<cql_server::response> 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<cql_server::response>(stream, cql_binary_opcode::SUPPORTED, tr_state);
|
||||
response->write_string_multimap(opts);
|
||||
return response;
|
||||
|
||||
Reference in New Issue
Block a user