Fix `max_read_amp` value in crash test (#12701)

Summary:
It should be no less than `level0_file_num_compaction_trigger`(which defaults to 4) when set to a positive value. Otherwise DB open will fail.

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

Test Plan: crash test not failing DB open due to this option value.

Reviewed By: ajkr

Differential Revision: D57825062

Pulled By: cbi42

fbshipit-source-id: 22d8e12aeceb5cef815157845995a8448552e2d2
This commit is contained in:
Changyu Bi 2024-05-26 17:26:55 -07:00 committed by Facebook GitHub Bot
parent 0e5ed2e0c8
commit 0ee7f8bacb
2 changed files with 6 additions and 4 deletions

View File

@ -1532,12 +1532,14 @@ Status ColumnFamilyData::ValidateOptions(
if (cf_options.compaction_style == kCompactionStyleUniversal) { if (cf_options.compaction_style == kCompactionStyleUniversal) {
int max_read_amp = cf_options.compaction_options_universal.max_read_amp; int max_read_amp = cf_options.compaction_options_universal.max_read_amp;
if (max_read_amp < -1) { if (max_read_amp < -1) {
return Status::NotSupported("max_read_amp should be at least -1."); return Status::NotSupported(
"CompactionOptionsUniversal::max_read_amp should be at least -1.");
} else if (0 < max_read_amp && } else if (0 < max_read_amp &&
max_read_amp < cf_options.level0_file_num_compaction_trigger) { max_read_amp < cf_options.level0_file_num_compaction_trigger) {
return Status::NotSupported( return Status::NotSupported(
"max_read_amp limits the number of sorted runs but is smaller than " "CompactionOptionsUniversal::max_read_amp limits the number of sorted"
"the compaction trigger level0_file_num_compaction_trigger."); " runs but is smaller than the compaction trigger "
"level0_file_num_compaction_trigger.");
} }
} }
return s; return s;

View File

@ -312,7 +312,7 @@ default_params = {
"check_multiget_consistency": lambda: random.choice([0, 0, 0, 1]), "check_multiget_consistency": lambda: random.choice([0, 0, 0, 1]),
"check_multiget_entity_consistency": lambda: random.choice([0, 0, 0, 1]), "check_multiget_entity_consistency": lambda: random.choice([0, 0, 0, 1]),
"use_timed_put_one_in": lambda: random.choice([0] * 7 + [1, 5, 10]), "use_timed_put_one_in": lambda: random.choice([0] * 7 + [1, 5, 10]),
"universal_max_read_amp": lambda : random.choice([-1] * 3 + [0, 3, 10]), "universal_max_read_amp": lambda : random.choice([-1] * 3 + [0, 4, 10]),
} }
_TEST_DIR_ENV_VAR = "TEST_TMPDIR" _TEST_DIR_ENV_VAR = "TEST_TMPDIR"
# If TEST_TMPDIR_EXPECTED is not specified, default value will be TEST_TMPDIR # If TEST_TMPDIR_EXPECTED is not specified, default value will be TEST_TMPDIR