diff --git a/CMakeLists.txt b/CMakeLists.txt index 089af59385..161e366875 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -578,7 +578,7 @@ set(scylla_sources service/raft/raft_group_registry.cc service/raft/raft_rpc.cc service/raft/raft_sys_table_storage.cc - service/raft/schema_raft_state_machine.cc + service/raft/group0_state_machine.cc service/storage_proxy.cc service/storage_service.cc sstables/compress.cc diff --git a/configure.py b/configure.py index 6fcb91dd20..806ec85760 100755 --- a/configure.py +++ b/configure.py @@ -1001,7 +1001,7 @@ scylla_core = (['replica/database.cc', 'mutation_writer/feed_writers.cc', 'lang/lua.cc', 'lang/wasm.cc', - 'service/raft/schema_raft_state_machine.cc', + 'service/raft/group0_state_machine.cc', 'service/raft/raft_sys_table_storage.cc', 'serializer.cc', 'release.cc', diff --git a/service/raft/schema_raft_state_machine.cc b/service/raft/group0_state_machine.cc similarity index 75% rename from service/raft/schema_raft_state_machine.cc rename to service/raft/group0_state_machine.cc index 6fb7d5ae93..33c85d6f17 100644 --- a/service/raft/schema_raft_state_machine.cc +++ b/service/raft/group0_state_machine.cc @@ -5,7 +5,7 @@ /* * SPDX-License-Identifier: AGPL-3.0-or-later */ -#include "service/raft/schema_raft_state_machine.hh" +#include "service/raft/group0_state_machine.hh" #include #include "service/migration_manager.hh" #include "message/messaging_service.hh" @@ -25,7 +25,7 @@ namespace service { static logging::logger slogger("schema_raft_sm"); -future<> schema_raft_state_machine::apply(std::vector command) { +future<> group0_state_machine::apply(std::vector command) { slogger.trace("apply() is called"); for (auto&& c : command) { auto is = ser::as_input_stream(c); @@ -37,26 +37,26 @@ future<> schema_raft_state_machine::apply(std::vector comman } } -future schema_raft_state_machine::take_snapshot() { +future group0_state_machine::take_snapshot() { return make_ready_future(raft::snapshot_id::create_random_id()); } -void schema_raft_state_machine::drop_snapshot(raft::snapshot_id id) { +void group0_state_machine::drop_snapshot(raft::snapshot_id id) { (void) id; } -future<> schema_raft_state_machine::load_snapshot(raft::snapshot_id id) { +future<> group0_state_machine::load_snapshot(raft::snapshot_id id) { return make_ready_future<>(); } -future<> schema_raft_state_machine::transfer_snapshot(gms::inet_address from, raft::snapshot_id snp) { +future<> group0_state_machine::transfer_snapshot(gms::inet_address from, raft::snapshot_id snp) { // Note that this may bring newer state than the schema state machine raft's // log, so some raft entries may be double applied, but since the state // machine idempotent it is not a problem. return _mm.submit_migration_task(from, false); } -future<> schema_raft_state_machine::abort() { +future<> group0_state_machine::abort() { return make_ready_future<>(); } diff --git a/service/raft/schema_raft_state_machine.hh b/service/raft/group0_state_machine.hh similarity index 72% rename from service/raft/schema_raft_state_machine.hh rename to service/raft/group0_state_machine.hh index 0dfcd5065f..6d890bcdf0 100644 --- a/service/raft/schema_raft_state_machine.hh +++ b/service/raft/group0_state_machine.hh @@ -16,12 +16,12 @@ class migration_manager; class migration_manager; -// Raft state machine implementation for managing schema changes. -// NOTE: schema raft server is always instantiated on shard 0. -class schema_raft_state_machine : public raft_state_machine { +// Raft state machine implementation for managing group 0 changes (e.g. schema changes). +// NOTE: group 0 raft server is always instantiated on shard 0. +class group0_state_machine : public raft_state_machine { migration_manager& _mm; public: - schema_raft_state_machine(migration_manager& mm) : _mm(mm) {} + group0_state_machine(migration_manager& mm) : _mm(mm) {} future<> apply(std::vector command) override; future take_snapshot() override; void drop_snapshot(raft::snapshot_id id) override; diff --git a/service/raft/raft_group0.cc b/service/raft/raft_group0.cc index 9af695d071..3f01b59694 100644 --- a/service/raft/raft_group0.cc +++ b/service/raft/raft_group0.cc @@ -9,7 +9,7 @@ #include "service/raft/raft_rpc.hh" #include "service/raft/raft_gossip_failure_detector.hh" #include "service/raft/raft_sys_table_storage.hh" -#include "service/raft/schema_raft_state_machine.hh" +#include "service/raft/group0_state_machine.hh" #include "message/messaging_service.hh" #include "cql3/query_processor.hh" @@ -50,7 +50,7 @@ raft_server_for_group raft_group0::create_server_for_group(raft::group_id gid, raft::server_address my_addr) { _raft_gr.address_map().set(my_addr); - auto state_machine = std::make_unique(_mm); + auto state_machine = std::make_unique(_mm); auto rpc = std::make_unique(*state_machine, _ms, _raft_gr.address_map(), gid, my_addr.id); // Keep a reference to a specific RPC class. auto& rpc_ref = *rpc;