Skip to content

Commit

Permalink
Fixes to the failing test case - no longer ignored
Browse files Browse the repository at this point in the history
We need to *restart* election on all the partitioned followers (so that
each one of them increases term by 1) and then they can lead to election
`Finished` state.

This is what will happen in real world where the followers will
determine the leader is `Confirmed` and independently update their
*term* and start a new election.

Signed-off-by: Abhijit Gadgil <[email protected]>
  • Loading branch information
agadgil-progress committed Oct 7, 2024
1 parent f11fa06 commit 0b12b7e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 0 additions & 3 deletions components/butterfly/src/rumor/election.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,6 @@ impl Rumor for Election {
} else if self.term > other.term {
debug!("stored rumor represents a newer term than received; keep sharing it");
true
} else if self.term > other.term {
debug!("stored rumor represents a newer term than received; keep sharing it");
true
} else if self.suitability > other.suitability {
debug!("stored rumor is more suitable; take received rumor's votes and share");
self.steal_votes(&mut other);
Expand Down
5 changes: 3 additions & 2 deletions components/butterfly/tests/rumor/election.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ fn five_members_elect_a_new_leader_when_the_old_one_dies() {
});
}

#[ignore = "Leader Election Algorithm Changed. Need to revisit this test."]
#[test]
#[allow(clippy::cognitive_complexity)]
fn five_members_elect_a_new_leader_when_they_are_quorum_partitioned() {
Expand Down Expand Up @@ -132,7 +131,9 @@ fn five_members_elect_a_new_leader_when_they_are_quorum_partitioned() {
net.partition(0..2, 2..5);
assert_wait_for_health_of_mlr!(net, [0..2, 2..5], Health::Confirmed);
net[0].restart_elections_rsw_mlr_rhw_msr(FeatureFlag::empty());
// net[4].restart_elections_rsw_mlr_rhw_msr(FeatureFlag::empty());
net[2].restart_elections_rsw_mlr_rhw_msr(FeatureFlag::empty());
net[3].restart_elections_rsw_mlr_rhw_msr(FeatureFlag::empty());
net[4].restart_elections_rsw_mlr_rhw_msr(FeatureFlag::empty());
assert_wait_for_election_status!(net, 0, "witcher.prod", ElectionStatus::NoQuorum);
assert_wait_for_election_status!(net, 1, "witcher.prod", ElectionStatus::NoQuorum);
assert_wait_for_election_status!(net, 2, "witcher.prod", ElectionStatus::Finished);
Expand Down

0 comments on commit 0b12b7e

Please sign in to comment.