Skip to content

Commit

Permalink
fix marking self as confirmed and remove an unneeded election condition
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Wrock <[email protected]>
  • Loading branch information
mwrock committed Nov 6, 2024
1 parent b835a4a commit 5dd4375
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions components/butterfly/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ impl Server {
/// * `Server::member` (write)
/// * `RumorHeat::inner` (write)
fn insert_member_from_rumor_mlw_smw_rhw(&self, member: Member, mut health: Health) {
trace!("insert_member_from_rumor_mlw_smw_rhw");
trace!("insert_member_from_rumor_mlw_smw_rhw for {}", member.id);
let rk: RumorKey = RumorKey::from(&member);

if member.id != self.member_id() {
Expand Down Expand Up @@ -730,13 +730,14 @@ impl Server {
debug!("Member: {} Does not exist in the Member List.", member.id);
}
}
} else if health != Health::Alive
&& member.incarnation >= self.myself.lock_smr().incarnation()
{
self.myself
} else if health != Health::Alive {
trace!("member incarnation is {}. my incarnation is {}", member.incarnation, self.myself.lock_smr().incarnation());
health = Health::Alive;
if member.incarnation >= self.myself.lock_smr().incarnation() {
self.myself
.lock_smw()
.refute_incarnation(member.incarnation);
health = Health::Alive;
}
}

let member_id = member.id.clone();
Expand Down Expand Up @@ -1164,21 +1165,14 @@ impl Server {
self.start_election_rsw_mlr_rhw_msr(&election.service_group,
election.term,
Some(u64::MAX));
} else if Some(election.member_id.as_str())
== self.election_store.lock_rsr().get_member_id(election.key())
{
debug!("Received New Term election from the leader. Starting my own to \
merge. Term: {}",
} else {
debug!("Received New Term election and I was not the previous leader. Term: {}",
election.term);
self.election_store
.remove_rsw(election.key(), election.id());
self.start_election_rsw_mlr_rhw_msr(&election.service_group,
election.term,
None);
} else {
warn!("Received a New Term Election, but not from the current leader, \
ignoring!");
return;
}
}
// If we are the member that this election is voting for, then check to see if the
Expand Down

0 comments on commit 5dd4375

Please sign in to comment.