Skip to content

Commit 1369b31

Browse files
STAR-247: Standalone scrubber should use the same default sstable format as specified for the test
Also made a small refactoring of dtest_config.py (cherry picked from commit 1253168) (cherry picked from commit 66b7cba) (cherry picked from commit fb9042e)
1 parent a9e646d commit 1369b31

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

dtest_config.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ def setup(self, config):
4545
self.sstable_format = config.getoption("--sstable-format")
4646
if self.sstable_format:
4747
assert self.sstable_format in ['bti', 'big'], "SSTable format {} is invalid - must be either bti or big".format(self.sstable_format)
48-
default_sstable_format_prop = " -Dcassandra.sstable.format.default=" + self.sstable_format
49-
os.environ.update({"JVM_EXTRA_OPTS": (os.environ.get("JVM_EXTRA_OPTS") or "") + default_sstable_format_prop})
5048

5149
self.use_vnodes = config.getoption("--use-vnodes")
5250
self.use_off_heap_memtables = config.getoption("--use-off-heap-memtables")
@@ -97,6 +95,17 @@ def setup(self, config):
9795
"--use-off-heap-memtables, see https://issues.apache.org/jira/browse/CASSANDRA-9472 "
9896
"for details" % version)
9997

98+
self.apply_to_env(os.environ, "JVM_EXTRA_OPTS")
99+
100+
def apply_to_env(self, env, key="JVM_OPTS"):
101+
current = env.get(key) or ""
102+
if self.sstable_format:
103+
default_sstable_format_prop = " -Dcassandra.sstable.format.default=" + self.sstable_format
104+
if not current.__contains__("-Dcassandra.sstable.format.default"):
105+
env.update({key: (env.get(key) or "") + default_sstable_format_prop})
106+
else:
107+
logger.debug("Skipped adding {} because it is already in the env key {}: {}".format(default_sstable_format_prop, key, current))
108+
100109
def get_version_from_build(self):
101110
# There are times when we want to know the C* version we're testing against
102111
# before we do any cluster. In the general case, we can't know that -- the

scrub_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ def launch_standalone_scrub(self, ks, cf, reinsert_overflowed_ttl=False, no_vali
116116
"""
117117
node1 = self.cluster.nodelist()[0]
118118
env = common.make_cassandra_env(node1.get_install_cassandra_root(), node1.get_node_cassandra_root())
119+
120+
self.dtest_config.apply_to_env(env, "JVM_OPTS")
121+
119122
scrub_bin = node1.get_tool('sstablescrub')
120123
logger.debug(scrub_bin)
121124

0 commit comments

Comments
 (0)