mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-01 04:26:48 +00:00
When a tablet is migrated into a new home, we need to clean its storage (i.e. the compaction group) in the old home. This includes its presence in row cache, which can be shared by multiple tablets living in the same shard. For exception safety, the following is done first in a "prepare phase" during cache invalidation. 1) take a compaction guard, to stop and disable compaction 2) flush memtable(s). 3) builds a list of all sstables, which represents all the storage of the tablet. Then once cache is invalidated successfully, we then clear the sstable sets of the the group in the "execution phase", to prevent any background op from incorrectly picking them and also to allow for their deletion. All the sstables of a tablet are deleted atomically, in order to guarantee that a failure midway won't cause data resurrection if it happens tablet is migrated back into the old home. Signed-off-by: Raphael S. Carvalho <raphaelsc@scylladb.com>