db: system_keyspace: take simpler service references in make
Take references to services which are initialized earlier. The references to `gossiper`, `storage_service` and `raft_group0_registry` are no longer needed. This will allow us to move the `make` step right after starting `system_keyspace`.
This commit is contained in:
@@ -2948,17 +2948,14 @@ static bool maybe_write_in_user_memory(schema_ptr s) {
|
||||
}
|
||||
|
||||
future<> system_keyspace::make(
|
||||
distributed<replica::database>& dist_db, distributed<service::storage_service>& dist_ss,
|
||||
sharded<gms::gossiper>& dist_gossiper, distributed<service::raft_group_registry>& 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<std::optional<sstring>> get_scylla_local_param(const sstring& key);
|
||||
|
||||
static std::vector<schema_ptr> all_tables(const db::config& cfg);
|
||||
future<> make(distributed<replica::database>& db,
|
||||
distributed<service::storage_service>& ss,
|
||||
sharded<gms::gossiper>& g,
|
||||
sharded<service::raft_group_registry>& 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<replica::database>&,
|
||||
|
||||
4
main.cc
4
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()) {
|
||||
|
||||
@@ -744,12 +744,12 @@ future<> distributed_loader::populate_keyspace(distributed<replica::database>& d
|
||||
});
|
||||
}
|
||||
|
||||
future<> distributed_loader::init_system_keyspace(sharded<db::system_keyspace>& sys_ks, distributed<replica::database>& db, distributed<service::storage_service>& ss, sharded<gms::gossiper>& g, sharded<service::raft_group_registry>& raft_gr, db::config& cfg, system_table_load_phase phase) {
|
||||
future<> distributed_loader::init_system_keyspace(sharded<db::system_keyspace>& sys_ks, distributed<locator::effective_replication_map_factory>& erm_factory, distributed<replica::database>& 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();
|
||||
|
||||
@@ -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<replica::database>& db, sstring datadir, sstring ks_name);
|
||||
|
||||
public:
|
||||
static future<> init_system_keyspace(sharded<db::system_keyspace>& sys_ks, distributed<replica::database>& db, distributed<service::storage_service>& ss, sharded<gms::gossiper>& g, sharded<service::raft_group_registry>& raft_gr, db::config& cfg, system_table_load_phase phase);
|
||||
static future<> init_system_keyspace(sharded<db::system_keyspace>&, distributed<locator::effective_replication_map_factory>&, distributed<replica::database>&, db::config& cfg, system_table_load_phase phase);
|
||||
static future<> init_non_system_keyspaces(distributed<replica::database>& db, distributed<service::storage_proxy>& proxy, sharded<db::system_keyspace>& sys_ks);
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user