mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-27 20:05:10 +00:00
Data-plane requests typically hold a strong pointer to the effective_replication_map (ERM) to protect against tablet migrations and other topology operations. This works because major steps in the topology coordinator use global barriers. These barriers install a new token_metadata version on each shard and wait for all references to the old one to be dropped. Since the ERM holds a strong pointer to token_metadata, it effectively blocks these operations until it's released. For LWT, we usually deal with a single token within a single tablet. In such cases, it's enough to block topology changes for just that one tablet. The existing tablet_metadata_guard class already supports this: it tracks tablet-specific changes and updates the ERM pointer automatically, unless the change affects the guarded tablet. However, this only works for tablet-aware tables. To support LWT with vnodes (i.e., non-tablet-aware tables), this commit introduces a new token_metadata_guard class. It wraps tablet_metadata_guard when the table uses tablets, and falls back to holding a plain strong ERM pointer otherwise. In the next commits, we’ll migrate LWT to use token_metadata_guard in paxos_response_handler instead of erm.