diff --git a/db/system_keyspace.cc b/db/system_keyspace.cc index f7f530ca53..77989b1383 100644 --- a/db/system_keyspace.cc +++ b/db/system_keyspace.cc @@ -2948,17 +2948,14 @@ static bool maybe_write_in_user_memory(schema_ptr s) { } future<> system_keyspace::make( - distributed& dist_db, distributed& dist_ss, - sharded& dist_gossiper, distributed& dist_raft_gr, - db::config& cfg, system_table_load_phase phase) { - auto& db = dist_db.local(); + locator::effective_replication_map_factory& erm_factory, + replica::database& db, db::config& cfg, system_table_load_phase phase) { for (auto&& table : system_keyspace::all_tables(db.get_config())) { if (table->static_props().load_phase != phase) { continue; } - co_await db.create_local_system_table( - table, maybe_write_in_user_memory(table), dist_ss.local().get_erm_factory()); + co_await db.create_local_system_table(table, maybe_write_in_user_memory(table), erm_factory); } } diff --git a/db/system_keyspace.hh b/db/system_keyspace.hh index 013055108a..770a5ccd94 100644 --- a/db/system_keyspace.hh +++ b/db/system_keyspace.hh @@ -59,6 +59,7 @@ namespace gms { } namespace locator { + class effective_replication_map_factory; class endpoint_dc_rack; class snitch_ptr; } // namespace locator @@ -269,12 +270,11 @@ public: static future> get_scylla_local_param(const sstring& key); static std::vector all_tables(const db::config& cfg); - future<> make(distributed& db, - distributed& ss, - sharded& g, - sharded& raft_gr, - db::config& cfg, - system_table_load_phase phase); + future<> make( + locator::effective_replication_map_factory&, + replica::database&, + db::config&, + system_table_load_phase phase); future<> initialize_virtual_tables( distributed&, diff --git a/main.cc b/main.cc index 1264c0c62f..28e51e0f21 100644 --- a/main.cc +++ b/main.cc @@ -1231,7 +1231,7 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl // done only by shard 0, so we'll no longer face race conditions as // described here: https://github.com/scylladb/scylla/issues/1014 supervisor::notify("loading system sstables"); - replica::distributed_loader::init_system_keyspace(sys_ks, db, ss, gossiper, raft_gr, *cfg, system_table_load_phase::phase1).get(); + replica::distributed_loader::init_system_keyspace(sys_ks, erm_factory, db, *cfg, system_table_load_phase::phase1).get(); supervisor::notify("initializing virtual tables"); sys_ks.invoke_on_all([&db, &ss, &gossiper, &raft_gr, &cfg] (db::system_keyspace& sys_ks) { return sys_ks.initialize_virtual_tables(db, ss, gossiper, raft_gr, *cfg); @@ -1319,7 +1319,7 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl // because table construction consults enabled features. // Needs to be before system_keyspace::setup(), which writes to schema tables. supervisor::notify("loading system_schema sstables"); - replica::distributed_loader::init_system_keyspace(sys_ks, db, ss, gossiper, raft_gr, *cfg, system_table_load_phase::phase2).get(); + replica::distributed_loader::init_system_keyspace(sys_ks, erm_factory, db, *cfg, system_table_load_phase::phase2).get(); if (raft_gr.local().is_enabled()) { if (!db.local().uses_schema_commitlog()) { diff --git a/replica/distributed_loader.cc b/replica/distributed_loader.cc index 9e3bc6ddc1..2c533a6208 100644 --- a/replica/distributed_loader.cc +++ b/replica/distributed_loader.cc @@ -744,12 +744,12 @@ future<> distributed_loader::populate_keyspace(distributed& d }); } -future<> distributed_loader::init_system_keyspace(sharded& sys_ks, distributed& db, distributed& ss, sharded& g, sharded& raft_gr, db::config& cfg, system_table_load_phase phase) { +future<> distributed_loader::init_system_keyspace(sharded& sys_ks, distributed& erm_factory, distributed& db, db::config& cfg, system_table_load_phase phase) { population_started = true; - return seastar::async([&sys_ks, &db, &ss, &cfg, &g, &raft_gr, phase] { - sys_ks.invoke_on_all([&db, &ss, &cfg, &g, &raft_gr, phase] (auto& sys_ks) { - return sys_ks.make(db, ss, g, raft_gr, cfg, phase); + return seastar::async([&sys_ks, &erm_factory, &db, &cfg, phase] { + sys_ks.invoke_on_all([&erm_factory, &db, &cfg, phase] (auto& sys_ks) { + return sys_ks.make(erm_factory.local(), db.local(), cfg, phase); }).get(); const auto& cfg = db.local().get_config(); diff --git a/replica/distributed_loader.hh b/replica/distributed_loader.hh index d7855721c9..95a7036a0b 100644 --- a/replica/distributed_loader.hh +++ b/replica/distributed_loader.hh @@ -47,13 +47,11 @@ class foreign_sstable_open_info; namespace service { class storage_proxy; -class storage_service; -class raft_group_registry; } -namespace gms { -class gossiper; +namespace locator { +class effective_replication_map_factory; } class distributed_loader_for_tests; @@ -78,7 +76,7 @@ class distributed_loader { static future<> populate_keyspace(distributed& db, sstring datadir, sstring ks_name); public: - static future<> init_system_keyspace(sharded& sys_ks, distributed& db, distributed& ss, sharded& g, sharded& raft_gr, db::config& cfg, system_table_load_phase phase); + static future<> init_system_keyspace(sharded&, distributed&, distributed&, db::config& cfg, system_table_load_phase phase); static future<> init_non_system_keyspaces(distributed& db, distributed& proxy, sharded& sys_ks); /** diff --git a/test/lib/cql_test_env.cc b/test/lib/cql_test_env.cc index abf6415786..f13b156346 100644 --- a/test/lib/cql_test_env.cc +++ b/test/lib/cql_test_env.cc @@ -847,7 +847,7 @@ public: }).get(); for (const auto p: all_system_table_load_phases) { - replica::distributed_loader::init_system_keyspace(sys_ks, db, ss, gossiper, raft_gr, *cfg, p).get(); + replica::distributed_loader::init_system_keyspace(sys_ks, erm_factory, db, *cfg, p).get(); } sys_ks.invoke_on_all([&db, &ss, &gossiper, &raft_gr, &cfg] (db::system_keyspace& sys_ks) { return sys_ks.initialize_virtual_tables(db, ss, gossiper, raft_gr, *cfg);