Skip to content

Commit

Permalink
STAR-247: Standalone scrubber should use the same default sstable for…
Browse files Browse the repository at this point in the history
…mat 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)
(cherry picked from commit 1369b31)
  • Loading branch information
jacek-lewandowski committed May 24, 2022
1 parent 2225baf commit 8c34af1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 11 additions & 2 deletions dtest_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ def setup(self, config):
self.sstable_format = config.getoption("--sstable-format")
if self.sstable_format:
assert self.sstable_format in ['bti', 'big'], "SSTable format {} is invalid - must be either bti or big".format(self.sstable_format)
default_sstable_format_prop = " -Dcassandra.sstable.format.default=" + self.sstable_format
os.environ.update({"JVM_EXTRA_OPTS": (os.environ.get("JVM_EXTRA_OPTS") or "") + default_sstable_format_prop})

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

self.apply_to_env(os.environ, "JVM_EXTRA_OPTS")

def apply_to_env(self, env, key="JVM_OPTS"):
current = env.get(key) or ""
if self.sstable_format:
default_sstable_format_prop = " -Dcassandra.sstable.format.default=" + self.sstable_format
if not current.__contains__("-Dcassandra.sstable.format.default"):
env.update({key: (env.get(key) or "") + default_sstable_format_prop})
else:
logger.debug("Skipped adding {} because it is already in the env key {}: {}".format(default_sstable_format_prop, key, current))

def get_version_from_build(self):
# There are times when we want to know the C* version we're testing against
# before we do any cluster. In the general case, we can't know that -- the
Expand Down
3 changes: 3 additions & 0 deletions scrub_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ def launch_standalone_scrub(self, ks, cf, reinsert_overflowed_ttl=False, no_vali
"""
node1 = self.cluster.nodelist()[0]
env = common.make_cassandra_env(node1.get_install_cassandra_root(), node1.get_node_cassandra_root())

self.dtest_config.apply_to_env(env, "JVM_OPTS")

scrub_bin = node1.get_tool('sstablescrub')
logger.debug(scrub_bin)

Expand Down

0 comments on commit 8c34af1

Please sign in to comment.