toplogy: Use the provided dc/rack info
Previous patches made all the callers of topology.update_endpoint() (via token_metadata.update_topology()) provide correct dc/rack info for the endpoint. It's now possible to stop using global snitch by topology and just rely on the dc/rack argument. Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
@@ -1248,21 +1248,18 @@ topology::topology(const topology& other) {
|
||||
|
||||
void topology::update_endpoint(const inet_address& ep, endpoint_dc_rack dr)
|
||||
{
|
||||
auto& snitch = i_endpoint_snitch::get_local_snitch_ptr();
|
||||
sstring dc = snitch->get_datacenter(ep);
|
||||
sstring rack = snitch->get_rack(ep);
|
||||
auto current = _current_locations.find(ep);
|
||||
|
||||
if (current != _current_locations.end()) {
|
||||
if (current->second.dc == dc && current->second.rack == rack) {
|
||||
if (current->second.dc == dr.dc && current->second.rack == dr.rack) {
|
||||
return;
|
||||
}
|
||||
remove_endpoint(ep);
|
||||
}
|
||||
|
||||
_dc_endpoints[dc].insert(ep);
|
||||
_dc_racks[dc][rack].insert(ep);
|
||||
_current_locations[ep] = {dc, rack};
|
||||
_dc_endpoints[dr.dc].insert(ep);
|
||||
_dc_racks[dr.dc][dr.rack].insert(ep);
|
||||
_current_locations[ep] = std::move(dr);
|
||||
}
|
||||
|
||||
void topology::remove_endpoint(inet_address ep)
|
||||
|
||||
Reference in New Issue
Block a user