service: raft: rename schema_raft_state_machine to group0_state_machine

Generalize the name so it doesn't suggest that group 0 contains only
schema state.
This commit is contained in:
Kamil Braun
2022-01-06 19:03:13 +01:00
parent 86762a1dd9
commit 538cc6ecb9
5 changed files with 15 additions and 15 deletions

View File

@@ -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

View File

@@ -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',

View File

@@ -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 <seastar/core/coroutine.hh>
#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<raft::command_cref> command) {
future<> group0_state_machine::apply(std::vector<raft::command_cref> 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<raft::command_cref> comman
}
}
future<raft::snapshot_id> schema_raft_state_machine::take_snapshot() {
future<raft::snapshot_id> group0_state_machine::take_snapshot() {
return make_ready_future<raft::snapshot_id>(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<>();
}

View File

@@ -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<raft::command_cref> command) override;
future<raft::snapshot_id> take_snapshot() override;
void drop_snapshot(raft::snapshot_id id) override;

View File

@@ -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<schema_raft_state_machine>(_mm);
auto state_machine = std::make_unique<group0_state_machine>(_mm);
auto rpc = std::make_unique<raft_rpc>(*state_machine, _ms, _raft_gr.address_map(), gid, my_addr.id);
// Keep a reference to a specific RPC class.
auto& rpc_ref = *rpc;