Make simple_bootstrap_test_small_keepalive_period faster/predictable with byteman
Project: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/commit/737aab2f Tree: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/tree/737aab2f Diff: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/diff/737aab2f Branch: refs/heads/master Commit: 737aab2fac109a2f8d3c840bc01f8bf22ab5fbe1 Parents: 795d91c Author: Paulo Motta <[email protected]> Authored: Thu Mar 30 19:43:58 2017 -0300 Committer: Paulo Motta <[email protected]> Committed: Fri Mar 31 13:50:31 2017 -0300 ---------------------------------------------------------------------- bootstrap_test.py | 23 ++++++++++++++--------- byteman/stream_5s_sleep.btm | 13 +++++++++++++ 2 files changed, 27 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/737aab2f/bootstrap_test.py ---------------------------------------------------------------------- diff --git a/bootstrap_test.py b/bootstrap_test.py index 048ab18..1d149e6 100644 --- a/bootstrap_test.py +++ b/bootstrap_test.py @@ -148,23 +148,28 @@ class TestBootstrap(BaseBootstrapTest): 2*streaming_keep_alive_period_in_secs to receive a single sstable """ cluster = self.cluster - cluster.set_configuration_options(values={'stream_throughput_outbound_megabits_per_sec': 1, - 'streaming_socket_timeout_in_ms': 1000, - 'streaming_keep_alive_period_in_secs': 1}) + cluster.set_configuration_options(values={'streaming_socket_timeout_in_ms': 1000, + 'streaming_keep_alive_period_in_secs': 2}) # Create a single node cluster cluster.populate(1) node1 = cluster.nodelist()[0] + + debug("Setting up byteman on {}".format(node1.name)) + # set up byteman + node1.byteman_port = '8100' + node1.import_config_files() + cluster.start(wait_other_notice=True) # Create more than one sstable larger than 1MB - node1.stress(['write', 'n=50K', '-rate', 'threads=8', '-schema', - 'compaction(strategy=SizeTieredCompactionStrategy, enabled=false)']) - cluster.flush() - node1.stress(['write', 'n=50K', '-rate', 'threads=8', '-schema', + node1.stress(['write', 'n=1K', '-rate', 'threads=8', '-schema', 'compaction(strategy=SizeTieredCompactionStrategy, enabled=false)']) cluster.flush() - self.assertGreater(node1.get_sstables("keyspace1", "standard1"), 1) + + debug("Submitting byteman script to {} to".format(node1.name)) + # Sleep longer than streaming_socket_timeout_in_ms to make sure the node will not be killed + node1.byteman_submit(['./byteman/stream_5s_sleep.btm']) # Bootstraping a new node with very small streaming_socket_timeout_in_ms node2 = new_node(cluster) @@ -174,7 +179,7 @@ class TestBootstrap(BaseBootstrapTest): assert_bootstrap_state(self, node2, 'COMPLETED') for node in cluster.nodelist(): - self.assertTrue(node.grep_log('Scheduling keep-alive task with 1s period.', filename='debug.log')) + self.assertTrue(node.grep_log('Scheduling keep-alive task with 2s period.', filename='debug.log')) self.assertTrue(node.grep_log('Sending keep-alive', filename='debug.log')) self.assertTrue(node.grep_log('Received keep-alive', filename='debug.log')) http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/737aab2f/byteman/stream_5s_sleep.btm ---------------------------------------------------------------------- diff --git a/byteman/stream_5s_sleep.btm b/byteman/stream_5s_sleep.btm new file mode 100644 index 0000000..0a4919a --- /dev/null +++ b/byteman/stream_5s_sleep.btm @@ -0,0 +1,13 @@ +# +# Sleep 5s during streaming session +# +RULE sleep 10s on stream session +CLASS org.apache.cassandra.streaming.StreamSession +METHOD messageReceived +AT ENTRY +# set flag to only run this rule once. +IF NOT flagged("done") +DO + flag("done"); + Thread.sleep(5000) +ENDRULE --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
