mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-05 14:33:08 +00:00
storage_service: get_mutable_token_metadata_ptr: always invalidate_cached_rings
We should invalidate the cached rings every time the token metadata changes, not only on topology changes to invalidate cached token/replication mappings when the modified token_metadata is committed. Currently we can do without it (apparently) but this will become a requirement for keep versions of the effective_replication_map in a registry, indexed by the token_metadata ring version, among other things. Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
@@ -3270,8 +3270,6 @@ future<> storage_service::keyspace_changed(const sstring& ks_name) {
|
||||
future<> storage_service::update_topology(inet_address endpoint) {
|
||||
return container().invoke_on(0, [endpoint] (auto& ss) {
|
||||
return ss.mutate_token_metadata([&ss, endpoint] (mutable_token_metadata_ptr tmptr) mutable {
|
||||
// initiate the token metadata endpoints cache reset
|
||||
tmptr->invalidate_cached_rings();
|
||||
// re-read local rack and DC info
|
||||
tmptr->update_topology(endpoint);
|
||||
return make_ready_future<>();
|
||||
|
||||
@@ -241,6 +241,10 @@ private:
|
||||
|
||||
future<mutable_token_metadata_ptr> get_mutable_token_metadata_ptr() noexcept {
|
||||
return _shared_token_metadata.get()->clone_async().then([] (token_metadata tm) {
|
||||
// bump the token_metadata ring_version
|
||||
// to invalidate cached token/replication mappings
|
||||
// when the modified token_metadata is committed.
|
||||
tm.invalidate_cached_rings();
|
||||
return make_ready_future<mutable_token_metadata_ptr>(make_token_metadata_ptr(std::move(tm)));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user