Skip to content

Commit

Permalink
Update max_gossip_rounds and removed partition iteration
Browse files Browse the repository at this point in the history
Signed-off-by: Abhijit Gadgil <[email protected]>
  • Loading branch information
agadgil-progress committed Oct 11, 2024
1 parent c1a7fcb commit 8eea706
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 27 deletions.
2 changes: 1 addition & 1 deletion components/butterfly/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ impl SwimNet {

pub fn max_rounds(&self) -> isize { 4 }

pub fn max_gossip_rounds(&self) -> isize { 5 }
pub fn max_gossip_rounds(&self) -> isize { 8 }

pub fn rounds(&self) -> Vec<isize> { self.members.iter().map(Server::swim_rounds).collect() }

Expand Down
50 changes: 24 additions & 26 deletions components/butterfly/tests/rumor/election.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,34 +251,32 @@ fn five_persistent_members_same_leader_multiple_non_quorum_partitions() {
// Making sure - running multiple times after a subset of follower (non-quorum) is partitioned
// and reconnected the leader stays the same.
let mut rng = rand::thread_rng();
for _ in 0..2 {
let idxes = Vec::from_iter(1_usize..5_usize).choose_multiple(&mut rng, 2)
.copied()
.collect::<Vec<usize>>();
for idx in idxes.iter() {
println!("idx: {}", idx);
net.partition_node(*idx);
assert_wait_for_health_of_mlr!(net, *idx, Health::Confirmed);
}
let first = idxes[0];
net[first].restart_elections_rsw_mlr_rhw_msr(FeatureFlag::empty());
assert_wait_for_election_status!(net, 0, "foobar.prod", ElectionStatus::Finished);
let idxes = Vec::from_iter(1_usize..5_usize).choose_multiple(&mut rng, 2)
.copied()
.collect::<Vec<usize>>();
for idx in idxes.iter() {
println!("idx: {}", idx);
net.partition_node(*idx);
assert_wait_for_health_of_mlr!(net, *idx, Health::Confirmed);
}
let first = idxes[0];
net[first].restart_elections_rsw_mlr_rhw_msr(FeatureFlag::empty());
assert_wait_for_election_status!(net, 0, "foobar.prod", ElectionStatus::Finished);

assert_wait_for_election_status!(net, first, "foobar.prod", ElectionStatus::NoQuorum);
assert_wait_for_election_status!(net, first, "foobar.prod", ElectionStatus::NoQuorum);

for idx in idxes.iter() {
net.unpartition_node(*idx);
assert_wait_for_health_of_mlr!(net, *idx, Health::Alive);
}
assert_wait_for_election_status!(net, first, "foobar.prod", ElectionStatus::Finished);
for idx in idxes.iter() {
net.unpartition_node(*idx);
assert_wait_for_health_of_mlr!(net, *idx, Health::Alive);
}
assert_wait_for_election_status!(net, first, "foobar.prod", ElectionStatus::Finished);

let new_leader_id = net[first].election_store
.lock_rsr()
.service_group("foobar.prod")
.map_rumor(Election::const_id(), |e| e.member_id.clone());
let new_leader_id = net[first].election_store
.lock_rsr()
.service_group("foobar.prod")
.map_rumor(Election::const_id(), |e| e.member_id.clone());

assert_eq!(leader_id, new_leader_id,
"OLD: {:?}, NEW: {:?}",
leader_id, new_leader_id);
}
assert_eq!(leader_id, new_leader_id,
"OLD: {:?}, NEW: {:?}",
leader_id, new_leader_id);
}

0 comments on commit 8eea706

Please sign in to comment.