Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/control_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ void ControlConnection::on_query_meta_schema(ControlConnection* control_connecti

Session* session = control_connection->session_;

// this clears token map and breaks token aware routing
session->metadata().clear_and_update_back();

bool is_initial_connection = (control_connection->state_ == CONTROL_STATE_NEW);
Expand Down Expand Up @@ -616,6 +617,7 @@ void ControlConnection::refresh_node_info(SharedRefPtr<Host> host,
}
}

// duplicate code with on_refresh_node_info_all
void ControlConnection::on_refresh_node_info(ControlConnection* control_connection,
const RefreshNodeData& data,
Response* response) {
Expand Down Expand Up @@ -644,6 +646,7 @@ void ControlConnection::on_refresh_node_info(ControlConnection* control_connecti
}
}

// duplicate code with on_refresh_node_info_all and query_host
void ControlConnection::on_refresh_node_info_all(ControlConnection* control_connection,
const RefreshNodeData& data,
Response* response) {
Expand Down
1 change: 1 addition & 0 deletions src/replication_strategy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ static DCRackMap racks_in_dcs(const TokenHostMap& token_hosts) {
return racks;
}

// @TODO: this method is unreadable, and seems too complex for what it does
void NetworkTopologyStrategy::tokens_to_replicas(const TokenHostMap& primary, TokenReplicaMap* output) const {
DCRackMap racks = racks_in_dcs(primary);

Expand Down
4 changes: 4 additions & 0 deletions src/token_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ void TokenMap::update_host(SharedRefPtr<Host>& host, const TokenStringList& toke
token_map_[partitioner_->token_from_string_ref(*i)] = host;
}
mapped_addresses_.insert(host->address());
// This should not be done for every host,
// it should be done only once at the end of the row/node loop when getting schema ,
// to lower the cost/complexity
// it takes >200ms on the client a vnode cluster of 10 nodes, so if you run it 10 times => 2s
map_replicas();
}

Expand Down