Skip to content
Snippets Groups Projects
Commit cc122873 authored by Yaroslav Dynnikov's avatar Yaroslav Dynnikov
Browse files

fix: potential panic in postjoin

No assumptions should be made on `traft::node::Status.leader_id`. It can
be set to `None` at any time due to a re-election.
parent d3eefd9a
No related branches found
No related tags found
1 merge request!340State of the art conf_change algorithm
......@@ -953,7 +953,7 @@ fn postjoin(args: &args::Run, storage: Storage) {
.with_target_grade(TargetGrade::Online)
.with_failure_domain(args.failure_domain());
let leader_id = node.status().leader_id.expect("leader_id deinitialized");
let leader_id = unwrap_some_or!(node.status().leader_id, continue);
let leader = storage.peers.get(&leader_id).unwrap();
// It's necessary to call `proc_update_peer` remotely on a
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment