Skip to content

Commit

Permalink
aliged tests with CASSANDRA-12937
Browse files Browse the repository at this point in the history
  • Loading branch information
smiklosovic committed Jul 19, 2023
1 parent f2b4818 commit 64c8da8
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 18 deletions.
36 changes: 24 additions & 12 deletions compression_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions configuration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion counter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cqlsh_tests/test_cqlsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion dtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}'
Expand Down
2 changes: 1 addition & 1 deletion scrub_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 64c8da8

Please sign in to comment.