From 0cf2c6aa3b30225b8637d1a669056ca144dfafc8 Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Thu, 27 Jan 2022 16:36:42 -0800 Subject: [PATCH] Fix/expand prefix extractor testing in crash test (#9461) Summary: Changes in https://github.com/facebook/rocksdb/issues/9453 could trigger ``` stderr: Error: prefixpercent is non-zero while prefix_size is not positive! ``` Pull Request resolved: https://github.com/facebook/rocksdb/pull/9461 Test Plan: run `make blackbox_crashtest` for a long time Reviewed By: ajkr Differential Revision: D33830751 Pulled By: pdillinger fbshipit-source-id: be88377dcaa47e4bb7adb0347762639eff8f1476 --- tools/db_crashtest.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/db_crashtest.py b/tools/db_crashtest.py index 2a34575f2..c979de3c1 100644 --- a/tools/db_crashtest.py +++ b/tools/db_crashtest.py @@ -87,7 +87,7 @@ default_params = { "partition_filters": lambda: random.randint(0, 1), "partition_pinning": lambda: random.randint(0, 3), "pause_background_one_in": 1000000, - "prefix_size" : -1, + "prefix_size" : lambda: random.choice([-1, 1, 5, 7, 8]), "prefixpercent": 5, "progress_reports": 0, "readpercent": 45, @@ -236,8 +236,6 @@ simple_default_params = { "max_background_compactions": 1, "max_bytes_for_level_base": 67108864, "memtablerep": "skip_list", - "prefixpercent": 0, - "readpercent": 50, "target_file_size_base": 16777216, "target_file_size_multiplier": 1, "test_batches_snapshots": 0, @@ -393,6 +391,9 @@ def finalize_and_sanitize(src_params): if (dest_params.get("prefix_size") == -1 and dest_params.get("memtable_whole_key_filtering") == 0): dest_params["memtable_prefix_bloom_size_ratio"] = 0 + if dest_params.get("prefix_size") == -1: + dest_params["readpercent"] += dest_params.get("prefixpercent", 20) + dest_params["prefixpercent"] = 0 return dest_params def gen_cmd_params(args):