Skip to content

Commit

Permalink
Adjust expected log messages in pending_ranges_test.py
Browse files Browse the repository at this point in the history
Patch by Sam Tunnicliffe; reviewed by Marcus Eriksson for CASSANDRA-19068
  • Loading branch information
Sam Tunnicliffe committed Nov 29, 2023
1 parent 203358e commit a9fe8ae
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
11 changes: 11 additions & 0 deletions byteman/post5.1/delay_streaming_for_move.btm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Make progress barrier block for 60s
#
RULE delay streaming for move
CLASS org.apache.cassandra.tcm.sequences.Move
METHOD movementMap
AT ENTRY
IF TRUE
DO
Thread.sleep(60000);
ENDRULE
22 changes: 15 additions & 7 deletions pending_range_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import logging
import time

import pytest
import re
import threading

from cassandra.query import SimpleStatement

from dtest import Tester, create_ks
from dtest import Tester, create_ks, mk_bman_path

from distutils.version import LooseVersion

logger = logging.getLogger(__name__)

Expand All @@ -25,7 +29,8 @@ def test_pending_range(self):

# Create 5 node cluster
ring_delay_ms = 3_600_000 # 1 hour
cluster.populate(5).start(jvm_args=['-Dcassandra.ring_delay_ms={}'.format(ring_delay_ms)])
install_byteman = cluster.version() >= '5.1'
cluster.populate(5, install_byteman=install_byteman).start(jvm_args=['-Dcassandra.ring_delay_ms={}'.format(ring_delay_ms)])
node1, node2 = cluster.nodelist()[0:2]

# Set up RF=3 keyspace
Expand All @@ -46,15 +51,18 @@ def test_pending_range(self):

token = '-634023222112864484'

mark = node1.mark_log()
# delay progress of the move operation to give a chance to kill the moving node
if self.cluster.version() >= LooseVersion('5.1'):
node1.byteman_submit([mk_bman_path('post5.1/delay_streaming_for_move.btm')])

mark = node1.mark_log()
# Move a node without waiting for the response of nodetool, so we don't have to wait for ring_delay
threading.Thread(target=(lambda: node1.nodetool('move {}'.format(token)))).start()

# Watch the log so we know when the node is moving
node1.watch_log_for('Moving .* to {}'.format(token), timeout=10, from_mark=mark)
node1.watch_log_for('Sleeping {} ms before start streaming/fetching ranges'.format(ring_delay_ms),
timeout=10, from_mark=mark)
node1.watch_log_for('Moving .* to \[?{}\]?'.format(token), timeout=10, from_mark=mark)
if self.cluster.version() < LooseVersion('5.1'):
node1.watch_log_for('Sleeping {} ms before start streaming/fetching ranges'.format(ring_delay_ms),
timeout=10, from_mark=mark)

# Watch the logs so we know when all the nodes see the status update to MOVING
for node in cluster.nodelist():
Expand Down

0 comments on commit a9fe8ae

Please sign in to comment.