Skip to content

Commit 7f35155

Browse files
committed
aliged tests with CASSANDRA-12937
1 parent 5021057 commit 7f35155

File tree

6 files changed

+31
-19
lines changed

6 files changed

+31
-19
lines changed

Diff for: compression_test.py

+25-13
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import pytest
33
import logging
44

5+
from distutils.version import LooseVersion
56
from dtest import create_ks
67
from scrub_test import TestHelper
78
from tools.assertions import assert_crc_check_chance_equal
@@ -80,25 +81,36 @@ def test_compression_cql_options(self):
8081
assert '256' == meta.options['compression']['chunk_length_in_kb']
8182
assert_crc_check_chance_equal(session, "compression_opts_table", 0.25)
8283

83-
warn = node.grep_log("The option crc_check_chance was deprecated as a compression option.")
84-
assert len(warn) == 0
85-
session.execute("""
86-
alter table compression_opts_table
87-
WITH compression = {
88-
'class': 'DeflateCompressor',
89-
'chunk_length_in_kb': 256,
90-
'crc_check_chance': 0.6
91-
}
92-
""")
93-
warn = node.grep_log("The option crc_check_chance was deprecated as a compression option.")
94-
assert len(warn) == 1
84+
if self.cluster.version() < LooseVersion('4.2'):
85+
warn = node.grep_log("The option crc_check_chance was deprecated as a compression option.")
86+
assert len(warn) == 0
87+
session.execute("""
88+
alter table compression_opts_table
89+
WITH compression = {
90+
'class': 'DeflateCompressor',
91+
'chunk_length_in_kb': 256,
92+
'crc_check_chance': 0.6
93+
}
94+
""")
95+
warn = node.grep_log("The option crc_check_chance was deprecated as a compression option.")
96+
assert len(warn) == 1
97+
else:
98+
session.execute("""
99+
alter table compression_opts_table
100+
WITH compression = {
101+
'class': 'DeflateCompressor',
102+
'chunk_length': '256KiB'
103+
}
104+
AND crc_check_chance = 0.6;
105+
""")
106+
95107

96108
# check metadata again after crc_check_chance_update
97109
session.cluster.refresh_schema_metadata()
98110
meta = session.cluster.metadata.keyspaces['ks'].tables['compression_opts_table']
99111
assert 'org.apache.cassandra.io.compress.DeflateCompressor' == meta.options['compression']['class']
100112
assert '256' == meta.options['compression']['chunk_length_in_kb']
101-
assert_crc_check_chance_equal(session, "compression_opts_table", 0.6)
113+
assert_crc_check_chance_equal(session, "compression_opts_table", 0.6)
102114

103115
for n in range(0, 100):
104116
session.execute("insert into compression_opts_table (id) values (uuid());")

Diff for: configuration_test.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ def test_compression_chunk_length(self):
3535

3636
create_table_query = "CREATE TABLE test_table (row varchar, name varchar, value int, PRIMARY KEY (row, name));"
3737
alter_chunk_len_query = "ALTER TABLE test_table WITH " \
38-
"compression = {{'sstable_compression' : 'SnappyCompressor', " \
39-
"'chunk_length_kb' : {chunk_length}}};"
38+
"compression = {{'class' : 'SnappyCompressor', " \
39+
"'chunk_length_in_kb' : {chunk_length}}};"
4040

4141
session.execute(create_table_query)
4242

Diff for: counter_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def test_upgrade(self):
177177
c counter
178178
)
179179
"""
180-
query = query + "WITH compression = { 'sstable_compression' : 'SnappyCompressor' }"
180+
query = query + "WITH compression = { 'class' : 'SnappyCompressor' }"
181181

182182
session.execute(query)
183183
time.sleep(2)

Diff for: cqlsh_tests/test_cqlsh.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ def test_with_empty_values(self):
624624
uuidcol uuid,
625625
varcharcol varchar,
626626
varintcol varint
627-
) WITH compression = {'sstable_compression':'LZ4Compressor'};
627+
) WITH compression = {'class':'LZ4Compressor'};
628628
629629
INSERT INTO has_all_types (num, intcol, asciicol, bigintcol, blobcol, booleancol,
630630
decimalcol, doublecol, floatcol, textcol,

Diff for: dtest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def create_cf(session, name, key_type="varchar", speculative_retry=None, read_re
335335
query = '%s AND CLUSTERING ORDER BY (%s)' % (query, clustering)
336336

337337
if compression is not None:
338-
query = '%s AND compression = { \'sstable_compression\': \'%sCompressor\' }' % (query, compression)
338+
query = '%s AND compression = { \'class\': \'%sCompressor\' }' % (query, compression)
339339
else:
340340
# if a compression option is omitted, C* will default to lz4 compression
341341
query += ' AND compression = {}'

Diff for: scrub_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def delete_non_essential_sstable_files(self, table):
7777
-Statistics.db file (only available in >= 3.0)
7878
"""
7979
for fname in self.get_sstable_files(self.get_table_paths(table)):
80-
if not fname.endswith("-Data.db") and not fname.endswith("-Statistics.db"):
80+
if not fname.endswith("-Data.db") and not fname.endswith("-Statistics.db") and not fname.endswith("-CompressionInfo.db"):
8181
paths = self.get_table_paths(table)
8282
for path in paths:
8383
fullname = os.path.join(path, fname)

0 commit comments

Comments
 (0)