Set options.num_levels in db_stress_test_base (#10732)

Summary:
An add-on to https://github.com/facebook/rocksdb/pull/6818 to complete adding single-level universal compaction to stress/crash testing.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/10732

Test Plan:
- Locally run for 10 min `python3 ./tools/db_crashtest.py whitebox --simple --compaction_style=1 --num_levels=1  -max_key=1000000 -value_size_mult=33 -write_buffer_size=524288 -target_file_size_base=524288 -max_bytes_for_level_base=2097152 --duration=120 --interval=10 --ops_per_thread=1000 --random_kill_odd=887`
   - Check LOG to confirm single-level universal compaction is called
- Manual testing and log checking to ensure destroy_db_initially=1 is correctly set across runs with different compaction styles (i.e, in the second half of whitebox testing).
- [ongoing]CI jobs stress test

Reviewed By: ajkr

Differential Revision: D39797612

Pulled By: ajkr

fbshipit-source-id: 16f5c40c3464c57360c06c8305f92118e426149c
main
Hui Xiao 2 years ago committed by Facebook GitHub Bot
parent 7045b74b47
commit f3b359a549
  1. 1
      db_stress_tool/db_stress_test_base.cc
  2. 8
      tools/db_crashtest.py

@ -3028,6 +3028,7 @@ void InitializeOptionsFromFlags(
static_cast<ROCKSDB_NAMESPACE::CompactionStyle>(FLAGS_compaction_style); static_cast<ROCKSDB_NAMESPACE::CompactionStyle>(FLAGS_compaction_style);
options.compaction_pri = options.compaction_pri =
static_cast<ROCKSDB_NAMESPACE::CompactionPri>(FLAGS_compaction_pri); static_cast<ROCKSDB_NAMESPACE::CompactionPri>(FLAGS_compaction_pri);
options.num_levels = FLAGS_num_levels;
if (FLAGS_prefix_size >= 0) { if (FLAGS_prefix_size >= 0) {
options.prefix_extractor.reset(NewFixedPrefixTransform(FLAGS_prefix_size)); options.prefix_extractor.reset(NewFixedPrefixTransform(FLAGS_prefix_size));
} }

@ -759,7 +759,7 @@ def whitebox_crash_main(args, unknown_args):
check_mode = 0 check_mode = 0
kill_random_test = cmd_params["random_kill_odd"] kill_random_test = cmd_params["random_kill_odd"]
kill_mode = 0 kill_mode = 0
prev_compaction_style = -1
while time.time() < exit_time: while time.time() < exit_time:
if check_mode == 0: if check_mode == 0:
additional_opts = { additional_opts = {
@ -833,6 +833,12 @@ def whitebox_crash_main(args, unknown_args):
"ops_per_thread": cmd_params["ops_per_thread"], "ops_per_thread": cmd_params["ops_per_thread"],
} }
cur_compaction_style = additional_opts.get("compaction_style", cmd_params.get("compaction_style", 0))
if prev_compaction_style != -1 and prev_compaction_style != cur_compaction_style:
print("`compaction_style` is changed in current run so `destroy_db_initially` is set to 1 as a short-term solution to avoid cycling through previous db of different compaction style." + "\n")
additional_opts["destroy_db_initially"] = 1
prev_compaction_style = cur_compaction_style
cmd = gen_cmd( cmd = gen_cmd(
dict( dict(
list(cmd_params.items()) list(cmd_params.items())

Loading…
Cancel
Save