Repository: cassandra-dtest
Updated Branches:
  refs/heads/master 9c2eb35a8 -> 95735a4d0


Make sure we don't deadlock on nodetool refresh

Patch by marcuse; reviewed by Jordan West for CASSANDRA-14310


Project: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/commit/95735a4d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/tree/95735a4d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/diff/95735a4d

Branch: refs/heads/master
Commit: 95735a4d0049249acc7de23465d89e07792c3de6
Parents: 9c2eb35
Author: Marcus Eriksson <[email protected]>
Authored: Mon Apr 9 13:56:28 2018 +0200
Committer: Marcus Eriksson <[email protected]>
Committed: Wed Apr 11 15:03:35 2018 +0200

----------------------------------------------------------------------
 byteman/sstable_open_delay.btm | 11 +++++++++++
 refresh_test.py                | 38 +++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/95735a4d/byteman/sstable_open_delay.btm
----------------------------------------------------------------------
diff --git a/byteman/sstable_open_delay.btm b/byteman/sstable_open_delay.btm
new file mode 100644
index 0000000..d31c2d0
--- /dev/null
+++ b/byteman/sstable_open_delay.btm
@@ -0,0 +1,11 @@
+#
+# Make sstable opening on startup slower
+#
+RULE slow startup sstable opening
+CLASS org.apache.cassandra.io.sstable.format.big.BigFormat$ReaderFactory
+METHOD open
+AT ENTRY
+IF TRUE
+DO
+    Thread.sleep(10000);
+ENDRULE

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/95735a4d/refresh_test.py
----------------------------------------------------------------------
diff --git a/refresh_test.py b/refresh_test.py
new file mode 100644
index 0000000..4177ec8
--- /dev/null
+++ b/refresh_test.py
@@ -0,0 +1,38 @@
+import time
+
+from dtest import Tester
+from ccmlib.node import ToolError
+import pytest
+
+since = pytest.mark.since
+
+@since('3.0')
+class TestRefresh(Tester):
+    def test_refresh_deadlock_startup(self):
+        """ Test refresh deadlock during startup (CASSANDRA-14310) """
+        self.cluster.populate(1)
+        node = self.cluster.nodelist()[0]
+        node.byteman_port = '8100'
+        node.import_config_files()
+        self.cluster.start(wait_other_notice=True)
+        session = self.patient_cql_connection(node)
+        session.execute("CREATE KEYSPACE ks WITH replication = 
{'class':'SimpleStrategy', 'replication_factor':1}")
+        session.execute("CREATE TABLE ks.a (id int primary key, d text)")
+        session.execute("CREATE TABLE ks.b (id int primary key, d text)")
+        node.nodetool("disableautocompaction") # make sure we have more than 1 
sstable
+        for x in range(0, 10):
+            session.execute("INSERT INTO ks.a (id, d) VALUES (%d, '%d 
%d')"%(x, x, x))
+            session.execute("INSERT INTO ks.b (id, d) VALUES (%d, '%d 
%d')"%(x, x, x))
+            node.flush()
+        node.stop()
+        node.update_startup_byteman_script('byteman/sstable_open_delay.btm')
+        node.start()
+        node.watch_log_for("opening keyspace ks", filename="debug.log")
+        time.sleep(5)
+        for x in range(0, 20):
+            try:
+                node.nodetool("refresh ks a")
+                node.nodetool("refresh ks b")
+            except ToolError:
+                pass # this is OK post-14310 - we just don't want to hang 
forever
+            time.sleep(1)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to