diff --git a/db_stress_tool/db_stress_common.h b/db_stress_tool/db_stress_common.h index df3311a08..e87d8a5b1 100644 --- a/db_stress_tool/db_stress_common.h +++ b/db_stress_tool/db_stress_common.h @@ -112,6 +112,7 @@ DECLARE_bool(memtable_whole_key_filtering); DECLARE_int32(open_files); DECLARE_int64(compressed_cache_size); DECLARE_int32(compaction_style); +DECLARE_int32(num_levels); DECLARE_int32(level0_file_num_compaction_trigger); DECLARE_int32(level0_slowdown_writes_trigger); DECLARE_int32(level0_stop_writes_trigger); diff --git a/db_stress_tool/db_stress_gflags.cc b/db_stress_tool/db_stress_gflags.cc index 9dd00ef4d..dba582fe4 100644 --- a/db_stress_tool/db_stress_gflags.cc +++ b/db_stress_tool/db_stress_gflags.cc @@ -186,6 +186,9 @@ DEFINE_int64(compressed_cache_size, -1, DEFINE_int32(compaction_style, ROCKSDB_NAMESPACE::Options().compaction_style, ""); +DEFINE_int32(num_levels, ROCKSDB_NAMESPACE::Options().num_levels, + "Number of levels in the DB"); + DEFINE_int32(level0_file_num_compaction_trigger, ROCKSDB_NAMESPACE::Options().level0_file_num_compaction_trigger, "Level0 compaction start trigger"); diff --git a/tools/db_crashtest.py b/tools/db_crashtest.py index bb9e758b0..a85cc480b 100644 --- a/tools/db_crashtest.py +++ b/tools/db_crashtest.py @@ -422,6 +422,12 @@ def whitebox_crash_main(args, unknown_args): "ops_per_thread": cmd_params['ops_per_thread'], "compaction_style": 1, } + # Single level universal has a lot of special logic. Ensure we cover + # it sometimes. + if random.randint(0, 1) == 1: + additional_opts.update({ + "num_levels": 1, + }) elif check_mode == 2: # normal run with FIFO compaction mode # ops_per_thread is divided by 5 because FIFO compaction