mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-05 14:33:08 +00:00
shared_token_metadata: set: check version monotonicity
Setting the ring version backwards means it got out of sync. Possibly concurrent updates weren't serialized properly using token_metadata_lock / mutate_token_metadata. Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
@@ -1424,6 +1424,13 @@ const endpoint_dc_rack& topology::get_location(const inet_address& ep) const {
|
||||
|
||||
/////////////////// class topology end /////////////////////////////////////////
|
||||
|
||||
void shared_token_metadata::set(mutable_token_metadata_ptr tmptr) noexcept {
|
||||
if (_shared->get_ring_version() >= tmptr->get_ring_version()) {
|
||||
on_internal_error(tlogger, format("shared_token_metadata: must not set non-increasing version: {} -> {}", _shared->get_ring_version(), tmptr->get_ring_version()));
|
||||
}
|
||||
_shared = std::move(tmptr);
|
||||
}
|
||||
|
||||
future<> shared_token_metadata::mutate_token_metadata(seastar::noncopyable_function<future<> (token_metadata&)> func) {
|
||||
auto lk = co_await get_lock();
|
||||
auto tm = co_await _shared->clone_async();
|
||||
|
||||
@@ -379,9 +379,7 @@ public:
|
||||
return _shared;
|
||||
}
|
||||
|
||||
void set(mutable_token_metadata_ptr tmptr) noexcept {
|
||||
_shared = std::move(tmptr);
|
||||
}
|
||||
void set(mutable_token_metadata_ptr tmptr) noexcept;
|
||||
|
||||
// Token metadata changes are serialized
|
||||
// using the schema_tables merge_lock.
|
||||
|
||||
Reference in New Issue
Block a user