Skip to content
Snippets Groups Projects
Commit 6a90d2c6 authored by Georgy Moshkin's avatar Georgy Moshkin :speech_balloon:
Browse files

refactor: check leader id from node directly rather then from status

parent 668f7237
No related branches found
No related tags found
No related merge requests found
Pipeline #13578 failed
......@@ -940,7 +940,6 @@ fn raft_conf_change_loop(status: Rc<Cell<Status>>, storage: Storage) {
continue 'governor;
}
let leader_id = status.get().id;
let peers = storage.peers.all_peers().unwrap();
let term = status.get().term;
let cluster_id = storage.raft.cluster_id().unwrap().unwrap();
......@@ -985,7 +984,7 @@ fn raft_conf_change_loop(status: Rc<Cell<Status>>, storage: Storage) {
);
// transfer leadership, if we're the one who goes offline
if peer.raft_id == leader_id {
if peer.raft_id == node.raft_id {
if let Some(new_leader) = maybe_responding(&peers).find(|peer| {
// FIXME: linear search
voters.contains(&peer.raft_id)
......@@ -1300,7 +1299,7 @@ fn raft_conf_change_loop(status: Rc<Cell<Status>>, storage: Storage) {
term,
commit,
timeout: SYNC_TIMEOUT,
bootstrap: !vshard_bootstrapped && peer.raft_id == leader_id,
bootstrap: !vshard_bootstrapped && peer.raft_id == node.raft_id,
},
)
});
......
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