diff --git a/locator/token_metadata.cc b/locator/token_metadata.cc index de220214b0..01de4505e4 100644 --- a/locator/token_metadata.cc +++ b/locator/token_metadata.cc @@ -76,8 +76,7 @@ void token_metadata::update_normal_tokens(std::unordered_map& tokens = i.second; @@ -92,17 +91,15 @@ void token_metadata::update_normal_tokens(std::unordered_map(t, endpoint)); should_sort_tokens |= prev.second; // new token inserted -> sort - if (prev.first->second != endpoint) { - //logger.warn("Token {} changing ownership from {} to {}", token, prev.first->second, endpoint); + if (prev.first->second != endpoint) { + // logger.warn("Token {} changing ownership from {} to {}", t, prev.first->second, endpoint); prev.first->second = endpoint; } } @@ -283,6 +280,12 @@ void token_metadata::remove_endpoint(inet_address endpoint) { invalidate_cached_rings(); } +void token_metadata::remove_from_moving(inet_address endpoint) { + remove_by_value(_moving_endpoints, endpoint); + invalidate_cached_rings(); +} + + /////////////////// class topology ///////////////////////////////////////////// inline void topology::clear() { _dc_endpoints.clear(); diff --git a/locator/token_metadata.hh b/locator/token_metadata.hh index c80517580e..3fc5970ce1 100644 --- a/locator/token_metadata.hh +++ b/locator/token_metadata.hh @@ -470,35 +470,13 @@ public: #endif public: void remove_endpoint(inet_address endpoint); -#if 0 /** * Remove pair of token/address from moving endpoints * @param endpoint address of the moving node */ - public void removeFromMoving(InetAddress endpoint) - { - assert endpoint != null; - - lock.writeLock().lock(); - try - { - for (Pair pair : _moving_endpoints) - { - if (pair.right.equals(endpoint)) - { - _moving_endpoints.remove(pair); - break; - } - } - - invalidateCachedRings(); - } - finally - { - lock.writeLock().unlock(); - } - } + void remove_from_moving(inet_address endpoint); +#if 0 public Collection getTokens(InetAddress endpoint) {