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 <xemul@scylladb.com>
This commit is contained in:
@@ -80,7 +80,6 @@ public:
|
||||
token_metadata_impl(token_metadata_impl&&) noexcept = default;
|
||||
const std::vector<token>& sorted_tokens() const;
|
||||
future<> update_normal_tokens(std::unordered_set<token> tokens, inet_address endpoint);
|
||||
future<> update_normal_tokens(const std::unordered_map<inet_address, std::unordered_set<token>>& endpoint_tokens);
|
||||
const token& first_token(const token& start) const;
|
||||
size_t first_token_index(const token& start) const;
|
||||
std::optional<inet_address> get_endpoint(const token& token) const;
|
||||
@@ -422,19 +421,8 @@ future<> token_metadata_impl::update_normal_tokens(std::unordered_set<token> tok
|
||||
if (tokens.empty()) {
|
||||
co_return;
|
||||
}
|
||||
std::unordered_map<inet_address, std::unordered_set<token>> 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<inet_address, std::unordered_set<token>>& 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_map<inet
|
||||
prev.first->second = 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<token> tokens, inet_addr
|
||||
return _impl->update_normal_tokens(std::move(tokens), endpoint);
|
||||
}
|
||||
|
||||
future<>
|
||||
token_metadata::update_normal_tokens(const std::unordered_map<inet_address, std::unordered_set<token>>& endpoint_tokens) {
|
||||
return _impl->update_normal_tokens(endpoint_tokens);
|
||||
}
|
||||
|
||||
const token&
|
||||
token_metadata::first_token(const token& start) const {
|
||||
return _impl->first_token(start);
|
||||
|
||||
@@ -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<token> 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<inet_address, std::unordered_set<token>>& endpoint_tokens);
|
||||
const token& first_token(const token& start) const;
|
||||
size_t first_token_index(const token& start) const;
|
||||
std::optional<inet_address> get_endpoint(const token& token) const;
|
||||
|
||||
Reference in New Issue
Block a user