raft: joint consensus, switch configuration to joint

In order to work correctly in transitional configuration,
participants must enter it after crashes, restarts and
state changes.

This means it must be stored in Raft log and snapshot
on the leader and followers.

This is most easily done if transitional configuration
is just a flavour of standard configuration.

In FSM, rename _current_config to _configuration,
it now contains both current and future configuration
at all times.
This commit is contained in:
Konstantin Osipov
2020-10-14 14:58:58 +03:00
parent 076e46af9e
commit df944f953c
4 changed files with 25 additions and 19 deletions

View File

@@ -324,11 +324,11 @@ future<std::vector<std::pair<std::unique_ptr<raft::server>, state_machine*>>> cr
for (size_t i = 0; i < states.size(); i++) {
auto uuid = utils::UUID(0, i + 1); // Custom sequential debug id; 0 is invalid
config.servers.push_back(raft::server_address{uuid});
config.current.push_back(raft::server_address{uuid});
}
for (size_t i = 0; i < states.size(); i++) {
auto& s = config.servers[i];
auto& s = config.current[i];
states[i].snapshot.config = config;
snapshots[s.id] = states[i].snp_value;
auto& raft = *rafts.emplace_back(create_raft_server(s.id, apply, states[i], apply_entries, type)).first;