Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle an edge case of removing server #129

Merged
merged 1 commit into from
Aug 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/handle_join_leave.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,22 @@ void raft_server::handle_join_leave_rpc_err(msg_type t_msg, ptr<peer> p) {
}
}

rm_srv_from_cluster(p->get_id());
if (srv_to_leave_) {
// WARNING:
// If `srv_to_leave_` is already set, this function is probably
// invoked by `handle_hb_timeout`. In such a case, the server
// to be removed does not respond while the leader already
// generated the log for the configuration change. We should
// abandon the peer entry from `peers_`.
p_wn("srv_to_leave_ is already set to %d, will remove it from "
"peer list", srv_to_leave_->get_id());
remove_peer_from_peers(srv_to_leave_);
reset_srv_to_leave();

} else {
// Set `srv_to_leave_` and generate a log for configuration change.
rm_srv_from_cluster(p->get_id());
}

} else {
p_in( "rpc failed again for the new coming server (%d), "
Expand Down