Skip to content

Commit

Permalink
migration_manager: take group0 lock during raft snapshot taking
Browse files Browse the repository at this point in the history
Group0 state machine access atomicity is guaranteed by a mutex in group0
client. A code that reads or writes the state needs to hold the log. To
transfer schema part of the snapshot we used existing "migration
request" verb which did not follow the rule. Fix the code to take group0
lock before accessing schema in case the verb is called as part of
group0 snapshot transfer.

Fixes #16821
  • Loading branch information
Gleb Natapov authored and kbr-scylla committed Feb 27, 2024
1 parent fd32e2e commit 0c37604
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions service/migration_manager.cc
Expand Up @@ -156,6 +156,10 @@ void migration_manager::init_messaging_service()
auto features = self._feat.cluster_schema_features();
auto& proxy = self._storage_proxy.container();
auto& db = proxy.local().get_db();
semaphore_units<> guard;
if (options->group0_snapshot_transfer) {
guard = co_await self._group0_client.hold_read_apply_mutex(self._as);
}
auto cm = co_await db::schema_tables::convert_schema_to_mutations(proxy, features);
if (options->group0_snapshot_transfer) {
cm.emplace_back(co_await db::system_keyspace::get_group0_history(db));
Expand Down

0 comments on commit 0c37604

Please sign in to comment.