Ignore test_collection_function after CASSANDRA-8877 trunk
authorBrandon Williams <brandonwilliams@apache.org>
Mon, 15 Aug 2022 22:48:39 +0000 (17:48 -0500)
committerBrandon Williams <brandonwilliams@apache.org>
Tue, 16 Aug 2022 17:20:36 +0000 (12:20 -0500)
Patch by brandonwilliams and adelapena; reviewed by adelapena and
brandonwilliams for CASSANDRA-17817

counter_test.py
lib/jolokia-jvm-1.6.2-agent.jar [deleted file]
lib/jolokia-jvm-1.7.1-agent.jar [new file with mode: 0644]
lib/jolokia-jvm-1.7.1-agent.jar.txt [moved from lib/jolokia-jvm-1.6.2-agent.jar.txt with 100% similarity]
tools/files.py
tools/jmxutils.py
ttl_test.py
upgrade_tests/compatibility_flag_test.py
upgrade_tests/cql_tests.py
upgrade_tests/upgrade_through_versions_test.py

index a4f80ef844311188d8d4fd723e8b946c49bc6ebb..103db9e4557da84209a1b6fd7158de39bebca2b0 100644 (file)
@@ -417,3 +417,28 @@ class TestCounters(Tester):
         for idx in range(0, 5):
             row = list(session.execute("SELECT data from counter_cs where key = {k}".format(k=idx)))
             assert rows_to_list(row)[0][0] == 5
+
+    def test_counter_node_down(self):
+        """
+        @jira_ticket CASSANDRA-17411
+        """
+        cluster = self.cluster
+        cluster.populate(3).start()
+        node1, node2, node3 = cluster.nodelist()
+        session = self.patient_cql_connection(node1)
+        create_ks(session, 'counter_tests', 3)
+
+        session.execute("""
+            CREATE TABLE IF NOT EXISTS counter_cs (
+                key text PRIMARY KEY,
+                count counter
+            )
+            """)
+
+        node2.stop(gently=False, wait_other_notice=True)
+
+        for _ in range(0, 20):
+            session.execute("UPDATE counter_cs SET count = count + 1 WHERE key = 'test'")
+
+        row = list(session.execute("SELECT count from counter_cs where key = 'test'"))
+        assert len(row) == 1
diff --git a/lib/jolokia-jvm-1.6.2-agent.jar b/lib/jolokia-jvm-1.6.2-agent.jar
deleted file mode 100644 (file)
index 68ee3e8..0000000
Binary files a/lib/jolokia-jvm-1.6.2-agent.jar and /dev/null differ
diff --git a/lib/jolokia-jvm-1.7.1-agent.jar b/lib/jolokia-jvm-1.7.1-agent.jar
new file mode 100644 (file)
index 0000000..fadd294
Binary files /dev/null and b/lib/jolokia-jvm-1.7.1-agent.jar differ
index 7f0cd97056eeeb365181a5aa5376121fcb916dcf..ea313ce8547c024c7bd55f0a88bab907f02fa386 100644 (file)
@@ -4,6 +4,7 @@ import re
 import sys
 import tempfile
 import logging
+import shutil
 
 logger = logging.getLogger(__name__)
 
@@ -40,3 +41,12 @@ def size_of_files_in_dir(dir_name, verbose=True):
     if verbose:
         logger.debug('getting sizes of these files: {}'.format(files))
     return sum(os.path.getsize(f) for f in files)
+
+def copytree(src, dst, symlinks=False, ignore=None):
+    for item in os.listdir(src):
+        s = os.path.join(src, item)
+        d = os.path.join(dst, item)
+        if os.path.isdir(s):
+            shutil.copytree(s, d, symlinks, ignore)
+        else:
+            shutil.copy2(s, d)
index 05957f15d02b92fc4770c9b417abc1fa527454fb..1b603447acffc207d1d347d338cea7a4fa4039cd 100644 (file)
@@ -9,7 +9,7 @@ import ccmlib.common as common
 
 logger = logging.getLogger(__name__)
 
-JOLOKIA_JAR = os.path.join(os.path.dirname(__file__), '..', 'lib', 'jolokia-jvm-1.6.2-agent.jar')
+JOLOKIA_JAR = os.path.join(os.path.dirname(__file__), '..', 'lib', 'jolokia-jvm-1.7.1-agent.jar')
 CLASSPATH_SEP = ';' if common.is_win() else ':'
 
 
index 7ebebae6f2fe5f016a7c9315f5a52d30939ffa49..7416e9c34f20eab9f7f7a7ed5ce99d78f5ac08b7 100644 (file)
@@ -4,7 +4,6 @@ import pytest
 import logging
 
 from collections import OrderedDict
-from distutils import dir_util
 from distutils.version import LooseVersion
 
 from cassandra import ConsistencyLevel, InvalidRequest
@@ -14,6 +13,7 @@ from cassandra.util import sortedset
 from dtest import Tester, create_ks
 from tools.assertions import (assert_all, assert_almost_equal, assert_none,
                               assert_row_count, assert_unavailable)
+from tools.files import copytree
 
 since = pytest.mark.since
 logger = logging.getLogger(__name__)
@@ -588,10 +588,11 @@ class TestRecoverNegativeExpirationDate(TestHelper):
         version = '2.1' if self.cluster.version() < LooseVersion('3.0') else \
                   ('3.0' if self.cluster.version() < LooseVersion('3.11') else '3.11')
 
-        corrupt_sstable_dir = os.path.join('sstables', 'ttl_test', version)
+        base_dir = os.path.dirname(os.path.abspath(__file__))
+        corrupt_sstable_dir = os.path.join(base_dir, 'sstables', 'ttl_test', version)
         table_dir = self.get_table_paths('ttl_table')[0]
         logger.debug("Copying sstables from {} into {}", corrupt_sstable_dir, table_dir)
-        dir_util.copy_tree(corrupt_sstable_dir, table_dir)
+        copytree(corrupt_sstable_dir, table_dir)
 
         logger.debug("Load corrupted sstable")
         node.nodetool('refresh ks ttl_table')
index f778cea422e807f5681df4b05fc3ed85c7ecd0d9..0bbc3da15c16d002e53371fd7a8acddfd5c47d59 100644 (file)
@@ -1,6 +1,8 @@
 import pytest
 import logging
 
+from cassandra import ConsistencyLevel
+from cassandra.query import SimpleStatement
 from dtest import Tester
 from tools.assertions import assert_all
 
@@ -93,17 +95,21 @@ class TestCompatibilityFlag(Tester):
 
         session.execute("CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '2'} ;")
         session.execute("CREATE TABLE test.test (a text PRIMARY KEY, b text, c text);")
+        session.cluster.control_connection.wait_for_schema_agreement()
 
         for i in range(1, 6):
-            session.execute("INSERT INTO test.test (a, b, c) VALUES ('{}', '{}', '{}');".format(i, i + 1, i + 2))
+            session.execute(SimpleStatement("INSERT INTO test.test (a, b, c) VALUES ('{}', '{}', '{}');".format(i, i + 1, i + 2),
+                                            consistency_level=ConsistencyLevel.ALL))
 
         assert_all(session,
                    "SELECT * FROM test.test",
-                   [[str(i), str(i + 1), str(i + 2)] for i in range(1, 6)], ignore_order=True)
+                   [[str(i), str(i + 1), str(i + 2)] for i in range(1, 6)], ignore_order=True,
+                   cl=ConsistencyLevel.ALL)
 
         assert_all(session,
                    "SELECT a,c FROM test.test",
-                   [[str(i), str(i + 2)] for i in range(1, 6)], ignore_order=True)
+                   [[str(i), str(i + 2)] for i in range(1, 6)], ignore_order=True,
+                   cl=ConsistencyLevel.ALL)
 
 
 @since('3.0.14', max_version='3.0.x')
index 59e37cb17978a2ffb13166a48e8e355ba95b8658..8c3cd9751d577d03cf27a2550d9b97e5b738158b 100644 (file)
@@ -2430,6 +2430,7 @@ class TestCQL(UpgradeTester):
             res = list(cursor.execute("SELECT * FROM test LIMIT {}".format(int(nb_keys / 2))))
             assert_length_equal(res, nb_keys / 2)
 
+    @since('2.0', max_version='4.1') # CASSANDRA-8877
     def test_collection_function(self):
         cursor = self.prepare()
 
index 4fda2233b930af672985d6c0647d7863e3d0148d..47f54281a16b02dd7f29c276afcb32349ed351f8 100644 (file)
@@ -210,6 +210,14 @@ def counter_incrementer(tester, to_verify_queue, verification_done_queue, rewrit
             session.execute(prepared, (key))
 
             to_verify_queue.put_nowait((key, count + 1,))
+        except DriverException as dex:
+            if "ID mismatch while trying to reprepare" in str(dex):
+                time.sleep(1)  # Pstmnt id mismatch, retry. See CASSANDRA-15252/17140
+                continue
+            else:
+                logger.error("Error in counter incrementer process!", dex)
+                shutdown_gently()
+                raise
         except Exception as ex:
             logger.error("Error in counter incrementer process!", ex)
             shutdown_gently()
@@ -258,6 +266,14 @@ def counter_checker(tester, to_verify_queue, verification_done_queue):
         except Empty:
             time.sleep(0.1)  # let's not eat CPU if the queue is empty
             continue
+        except DriverException as dex:
+            if "ID mismatch while trying to reprepare" in str(dex):
+                time.sleep(1)  # Pstmnt id mismatch, retry. See CASSANDRA-15252/17140
+                continue
+            else:
+                logger.error("Error in counter verifier process!", dex)
+                shutdown_gently()
+                raise
         except Exception as ex:
             logger.error("Error in counter verifier process!", ex)
             shutdown_gently()
@@ -302,6 +318,8 @@ class TestUpgrade(Tester):
             r'Unknown column cdc during deserialization',
             # may occur during 2.2 check for existing roles
             r'Got slice command for nonexistent table system_auth.roles',
+            # file may be read while being written; will be read again when done (CASSANDRA-17749)
+            r'Snitch definitions at cassandra-topology.properties do not define a location',
         )
 
     def prepare(self):