mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-23 00:02:37 +00:00
raft: set the current leader upon getting InstallSnapshot
If the current leader is set, the follower will not vote for another candidate. This is also known as "sticky leadership" rule. Before this change, the rule was enacted only upon receiving AppendEntries RPC from the leader. Turn it on also upon receiving InstallSnapshot RPC.
This commit is contained in:
@@ -386,7 +386,8 @@ void fsm::step(server_id from, Message&& msg) {
|
||||
logger.trace("{} [term: {}] received a message with higher term from {} [term: {}]",
|
||||
_my_id, _current_term, from, msg.current_term);
|
||||
|
||||
if constexpr (std::is_same_v<Message, append_request>) {
|
||||
if constexpr (std::is_same_v<Message, append_request> ||
|
||||
std::is_same_v<Message, install_snapshot>) {
|
||||
leader = from;
|
||||
} else {
|
||||
if constexpr (std::is_same_v<Message, vote_request>) {
|
||||
|
||||
Reference in New Issue
Block a user