Skip to content

Commit

Permalink
fix counter test
Browse files Browse the repository at this point in the history
  • Loading branch information
smiklosovic committed Feb 26, 2024
1 parent 238cf5e commit 266222f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions byteman/4.0/election_counter_leader_favor_node2.btm
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ RULE election counter leader cheat
CLASS org.apache.cassandra.service.StorageProxy
METHOD findSuitableEndpoint
AT EXIT
BIND isthere:boolean = $localEndpoints.contains(org.apache.cassandra.locator.InetAddressAndPort.getByName("127.0.0.2"));
BIND isthere:boolean = $localReplicas.stream().anyMatch(r -> { try { return r.endpoint().equals(org.apache.cassandra.locator.InetAddressAndPort.getByName("127.0.0.2")); } catch (Throwable t) { return false; } });
if isthere
DO
return org.apache.cassandra.locator.InetAddressAndPort.getByName("127.0.0.2");
return localReplicas.stream().filter(lr -> { try { return lr.endpoint().equals(InetAddressAndPort.getByName("127.0.0.2")); } catch (Throwable t) { return null; } }).findFirst().get();
ENDRULE
7 changes: 5 additions & 2 deletions counter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,11 @@ def test_counter_leader_with_partial_view(self):

# Now stop the node and restart but first install a rule to slow down how fast node 2 will update the list
# nodes that are alive
nodes[1].stop(wait=True, wait_other_notice=False)
nodes[1].update_startup_byteman_script(mk_bman_path('gossip_alive_callback_sleep.btm'))
nodes[1].stop(wait=True, wait_other_notice=True)

if cluster.version() < '5.1':
nodes[1].update_startup_byteman_script(mk_bman_path('gossip_alive_callback_sleep.btm'))

nodes[1].start(no_wait=True, wait_other_notice=False)

# Until node 2 is fully alive try to force other nodes to pick him as mutation leader.
Expand Down

0 comments on commit 266222f

Please sign in to comment.