From 64c8da8f1cad91b10467594ab82ab1d034ec57f6 Mon Sep 17 00:00:00 2001 From: Stefan Miklosovic Date: Tue, 30 May 2023 11:52:35 +0200 Subject: [PATCH] aliged tests with CASSANDRA-12937 --- compression_test.py | 36 ++++++++++++++++++++++++------------ configuration_test.py | 4 ++-- counter_test.py | 2 +- cqlsh_tests/test_cqlsh.py | 2 +- dtest.py | 2 +- scrub_test.py | 2 +- 6 files changed, 30 insertions(+), 18 deletions(-) diff --git a/compression_test.py b/compression_test.py index 0bb63446e9..0e4d7ef6c9 100644 --- a/compression_test.py +++ b/compression_test.py @@ -2,6 +2,7 @@ import pytest import logging +from distutils.version import LooseVersion from dtest import create_ks from scrub_test import TestHelper from tools.assertions import assert_crc_check_chance_equal @@ -80,18 +81,29 @@ def test_compression_cql_options(self): assert '256' == meta.options['compression']['chunk_length_in_kb'] assert_crc_check_chance_equal(session, "compression_opts_table", 0.25) - warn = node.grep_log("The option crc_check_chance was deprecated as a compression option.") - assert len(warn) == 0 - session.execute(""" - alter table compression_opts_table - WITH compression = { - 'class': 'DeflateCompressor', - 'chunk_length_in_kb': 256, - 'crc_check_chance': 0.6 - } - """) - warn = node.grep_log("The option crc_check_chance was deprecated as a compression option.") - assert len(warn) == 1 + if self.cluster.version() < LooseVersion('4.2'): + warn = node.grep_log("The option crc_check_chance was deprecated as a compression option.") + assert len(warn) == 0 + session.execute(""" + alter table compression_opts_table + WITH compression = { + 'class': 'DeflateCompressor', + 'chunk_length_in_kb': 256, + 'crc_check_chance': 0.6 + } + """) + warn = node.grep_log("The option crc_check_chance was deprecated as a compression option.") + assert len(warn) == 1 + else: + session.execute(""" + alter table compression_opts_table + WITH compression = { + 'class': 'DeflateCompressor', + 'chunk_length': '256KiB' + } + AND crc_check_chance = 0.6; + """) + # check metadata again after crc_check_chance_update session.cluster.refresh_schema_metadata() diff --git a/configuration_test.py b/configuration_test.py index 235cf7cea1..6fa5625eef 100644 --- a/configuration_test.py +++ b/configuration_test.py @@ -35,8 +35,8 @@ def test_compression_chunk_length(self): create_table_query = "CREATE TABLE test_table (row varchar, name varchar, value int, PRIMARY KEY (row, name));" alter_chunk_len_query = "ALTER TABLE test_table WITH " \ - "compression = {{'sstable_compression' : 'SnappyCompressor', " \ - "'chunk_length_kb' : {chunk_length}}};" + "compression = {{'class' : 'SnappyCompressor', " \ + "'chunk_length_in_kb' : {chunk_length}}};" session.execute(create_table_query) diff --git a/counter_test.py b/counter_test.py index aa8215e05c..44d37fcfdd 100644 --- a/counter_test.py +++ b/counter_test.py @@ -177,7 +177,7 @@ def test_upgrade(self): c counter ) """ - query = query + "WITH compression = { 'sstable_compression' : 'SnappyCompressor' }" + query = query + "WITH compression = { 'class' : 'SnappyCompressor' }" session.execute(query) time.sleep(2) diff --git a/cqlsh_tests/test_cqlsh.py b/cqlsh_tests/test_cqlsh.py index dd59ee0807..36a812d5fd 100644 --- a/cqlsh_tests/test_cqlsh.py +++ b/cqlsh_tests/test_cqlsh.py @@ -624,7 +624,7 @@ def test_with_empty_values(self): uuidcol uuid, varcharcol varchar, varintcol varint -) WITH compression = {'sstable_compression':'LZ4Compressor'}; +) WITH compression = {'class':'LZ4Compressor'}; INSERT INTO has_all_types (num, intcol, asciicol, bigintcol, blobcol, booleancol, decimalcol, doublecol, floatcol, textcol, diff --git a/dtest.py b/dtest.py index 4a167e128a..859922eb09 100644 --- a/dtest.py +++ b/dtest.py @@ -335,7 +335,7 @@ def create_cf(session, name, key_type="varchar", speculative_retry=None, read_re query = '%s AND CLUSTERING ORDER BY (%s)' % (query, clustering) if compression is not None: - query = '%s AND compression = { \'sstable_compression\': \'%sCompressor\' }' % (query, compression) + query = '%s AND compression = { \'class\': \'%sCompressor\' }' % (query, compression) else: # if a compression option is omitted, C* will default to lz4 compression query += ' AND compression = {}' diff --git a/scrub_test.py b/scrub_test.py index 3d50d70c31..b0bb87ae29 100644 --- a/scrub_test.py +++ b/scrub_test.py @@ -77,7 +77,7 @@ def delete_non_essential_sstable_files(self, table): -Statistics.db file (only available in >= 3.0) """ for fname in self.get_sstable_files(self.get_table_paths(table)): - if not fname.endswith("-Data.db") and not fname.endswith("-Statistics.db"): + if not fname.endswith("-Data.db") and not fname.endswith("-Statistics.db") and not fname.endswith("-CompressionInfo.db"): paths = self.get_table_paths(table) for path in paths: fullname = os.path.join(path, fname)