mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-20 00:20:47 +00:00
To create `process_staging` view building tasks, we firstly need to collect informations about them on shard0, create necessary mutations, commit them to group0 and move staging sstables objects to their original shards. But there is a possible race after committing the group0 command and before moving the staging sstables to their shards. Between those two events, the coordinator may schedule freshly created tasks and dispatch them to the worker but the worker won't have the sstables objects because they weren't moved yet. This patch fixes the race by holding `_staging_sstables_mutex` locks from all necessary shards when executing `create_staging_sstable_tasks()`. With this, even if the task will be scheduled and dispatched quickly, the worker will wait with executing it until the sstables objects are moved and the locks are released. Fixes SCYLLADB-816 This PR should be backported to all versions containing view building coordinator (2025.4 and newer). Closes scylladb/scylladb#29174 * github.com:scylladb/scylladb: db/view/view_building_worker: fix indentation db/view/view_building_worker: lock staging sstables mutex for necessary shards when creating tasks