topology: unindex_node: erase dc from datacenters when empty

In branch 5.2 we erase `dc` from `_datacenters` if there are
no more endpoints listed in `_dc_endpoints[dc]`.

This was lost unintentionally in f3d5df5448
and this commit restores that behavior, and fixes test_remove_endpoint.

Fixes scylladb/scylladb#14896

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>

Closes #14897
This commit is contained in:
Benny Halevy
2023-07-31 13:36:45 +03:00
committed by Botond Dénes
parent 0239ba4527
commit 949ea43034
2 changed files with 2 additions and 1 deletions

View File

@@ -360,6 +360,7 @@ void topology::unindex_node(const node* node) {
_dc_rack_nodes.erase(dc);
_dc_racks.erase(dc);
_dc_endpoints.erase(dit);
_datacenters.erase(dc);
} else {
_dc_rack_nodes[dc][rack].erase(node);
auto& racks = _dc_racks[dc];