Skip to content

Commit

Permalink
include leader_id or current role info in vote log
Browse files Browse the repository at this point in the history
Signed-off-by: glorv <[email protected]>
  • Loading branch information
glorv committed May 11, 2024
1 parent 668bed2 commit 1200beb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/raft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1148,12 +1148,14 @@ impl<T: Storage> Raft<T> {
let pending_request_snapshot = self.pending_request_snapshot;
self.reset(term);
self.leader_id = leader_id;
let from_role = self.state;
self.state = StateRole::Follower;
self.pending_request_snapshot = pending_request_snapshot;
info!(
self.logger,
"became follower at term {term}",
term = self.term;
"from_role" => ?from_role,
);
}

Expand Down Expand Up @@ -1366,6 +1368,7 @@ impl<T: Storage> Raft<T> {
"term" => self.term,
"remaining ticks" => self.election_timeout - self.election_elapsed,
"msg type" => ?m.get_msg_type(),
"leader_id" => self.leader_id,
);

return Ok(());
Expand Down

0 comments on commit 1200beb

Please sign in to comment.