File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -282,6 +282,18 @@ void Connector::on_supported(ResponseMessage* response) {
282282 SupportedResponse* supported = static_cast <SupportedResponse*>(response->response_body ().get ());
283283 supported_options_ = supported->supported_options ();
284284
285+ if (connection_->protocol_version ().supports_sharding ()) {
286+ auto conn_sharding_info_opt = ShardingInfo::parse_sharding_info (supported_options_);
287+ if (conn_sharding_info_opt) {
288+ connection_->set_shard_id (conn_sharding_info_opt->shard_id );
289+ connection_->host ()->set_sharding_info (std::move (conn_sharding_info_opt->sharding_info ));
290+ } else {
291+ LOG_ERROR (" Could not retrieve sharding info from control connection to %s."
292+ " Continuing WITHOUT SHARD-AWARENESS." ,
293+ connection_->address ().to_string ().c_str ());
294+ }
295+ }
296+
285297 connection_->write_and_flush (RequestCallback::Ptr (new StartupCallback (
286298 this , Request::ConstPtr (new StartupRequest (settings_.application_name ,
287299 settings_.application_version , settings_.client_id ,
You can’t perform that action at this time.
0 commit comments