mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-31 03:56:42 +00:00
We want to disable `migration_manager` schema pulls and make schema managed only by Raft group 0 if Raft is enabled. This will be important with Raft-based topology, when schema will depend on topology (e.g. for tablets). We solved the problem partially in PR #13695. However, it's still possible for a bootstrapping node to pull schema in the early part of bootstrap procedure, before it setups group 0, because of how the currently used `_raft_gr.using_raft()` check is implemented. Here's the list of cases: - If a node is bootstrapping in non-Raft mode, schema pulls must remain enabled. - If a node is bootstrapping in Raft mode, it should never perform a schema pull. - If a bootstrapped node is restarting in non-Raft mode but with Raft feature enabled (which means we should start upgrading to use Raft), or restarting in the middle of Raft upgrade procedure, schema pulls must remain enabled until the Raft upgrade procedure finishes. This is also the case of restarting after RECOVERY. - If a bootstrapped node is restarting in Raft mode, it should never perform a schema pull. The `raft_group0` service is responsible for setting up Raft during boot and for the Raft upgrade procedure. So this is the most natural place to make the decision that schema pulls should be disabled. Instead of trying to come up with a correct condition that fully covers the above list of cases, store a `bool` inside `migration_manager` and set it from `raft_group0` function at the right moment - when we decide that we should boot in Raft mode, or restart with Raft, or upgrade. Most of the conditions are already checked in `setup_group0_if_exist`, we just need to set the bool. Also print a log message when schema pulls are disabled. Fix a small bug in `migration_manager::get_schema_for_write` - it was possible for the function to mark schema as synced without actually syncing it if it was running concurrently to the Raft upgrade procedure. Correct some typos in comments and update the comments. Fixes #12870 Closes #14428 * github.com:scylladb/scylladb: raft_group_registry: remove `has_group0()` raft_group0_client: remove `using_raft()` migration_manager: disable schema pulls when schema is Raft-managed