|
2 | 2 | import pytest |
3 | 3 | import logging |
4 | 4 |
|
| 5 | +from distutils.version import LooseVersion |
5 | 6 | from dtest import create_ks |
6 | 7 | from scrub_test import TestHelper |
7 | 8 | from tools.assertions import assert_crc_check_chance_equal |
@@ -80,18 +81,29 @@ def test_compression_cql_options(self): |
80 | 81 | assert '256' == meta.options['compression']['chunk_length_in_kb'] |
81 | 82 | assert_crc_check_chance_equal(session, "compression_opts_table", 0.25) |
82 | 83 |
|
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 | + |
95 | 107 |
|
96 | 108 | # check metadata again after crc_check_chance_update |
97 | 109 | session.cluster.refresh_schema_metadata() |
|
0 commit comments