From 056d21c050b84f29e49dc71a2c3066662731d2f5 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Tue, 23 Aug 2022 11:25:51 +0300 Subject: [PATCH] token_metadata: Remove batch tokens updating method No users left. The endpoint_tokens.empty() check is removed, only tests could trigger it, but they didn't and are patched out. Indentation is left broken Signed-off-by: Pavel Emelyanov --- locator/token_metadata.cc | 19 +------------------ locator/token_metadata.hh | 6 ------ 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/locator/token_metadata.cc b/locator/token_metadata.cc index 07862c0fde..afbf2847cd 100644 --- a/locator/token_metadata.cc +++ b/locator/token_metadata.cc @@ -80,7 +80,6 @@ public: token_metadata_impl(token_metadata_impl&&) noexcept = default; const std::vector& sorted_tokens() const; future<> update_normal_tokens(std::unordered_set tokens, inet_address endpoint); - future<> update_normal_tokens(const std::unordered_map>& endpoint_tokens); const token& first_token(const token& start) const; size_t first_token_index(const token& start) const; std::optional get_endpoint(const token& token) const; @@ -422,19 +421,8 @@ future<> token_metadata_impl::update_normal_tokens(std::unordered_set tok if (tokens.empty()) { co_return; } - std::unordered_map> endpoint_tokens ({{endpoint, std::move(tokens)}}); - co_return co_await update_normal_tokens(endpoint_tokens); -} - -future<> token_metadata_impl::update_normal_tokens(const std::unordered_map>& endpoint_tokens) { - if (endpoint_tokens.empty()) { - co_return; - } bool should_sort_tokens = false; - for (auto&& i : endpoint_tokens) { - inet_address endpoint = i.first; - auto tokens = i.second; if (tokens.empty()) { auto msg = format("tokens is empty in update_normal_tokens"); @@ -478,7 +466,7 @@ future<> token_metadata_impl::update_normal_tokens(const std::unordered_mapsecond = endpoint; } } - } + co_await update_normal_token_owners(); // New tokens were added to _token_to_endpoint_map @@ -1004,11 +992,6 @@ token_metadata::update_normal_tokens(std::unordered_set tokens, inet_addr return _impl->update_normal_tokens(std::move(tokens), endpoint); } -future<> -token_metadata::update_normal_tokens(const std::unordered_map>& endpoint_tokens) { - return _impl->update_normal_tokens(endpoint_tokens); -} - const token& token_metadata::first_token(const token& start) const { return _impl->first_token(start); diff --git a/locator/token_metadata.hh b/locator/token_metadata.hh index a523f5ad4e..923b33e6de 100644 --- a/locator/token_metadata.hh +++ b/locator/token_metadata.hh @@ -167,12 +167,6 @@ public: // Note: the function is not exception safe! // It must be called only on a temporary copy of the token_metadata future<> update_normal_tokens(std::unordered_set tokens, inet_address endpoint); - // Batch update token->endpoint mappings for the given endpoints. - // The \c endpoint_tokens map contains the set of tokens currently owned by each respective endpoint. - // - // Note: the function is not exception safe! - // It must be called only on a temporary copy of the token_metadata - future<> update_normal_tokens(const std::unordered_map>& endpoint_tokens); const token& first_token(const token& start) const; size_t first_token_index(const token& start) const; std::optional get_endpoint(const token& token) const;