From f219e3d5d8888b3922e9d0e52eaae32f03485aed Mon Sep 17 00:00:00 2001 From: Mark Callaghan Date: Thu, 24 Mar 2022 11:46:27 -0700 Subject: [PATCH] db_bench should fail on bad values for --compaction_fadvice and --value_size_distribution_type (#9741) Summary: db_bench quietly parses and ignores bad values for --compaction_fadvice and --value_size_distribution_type I prefer that it fail for them as it does for bad option values in most other cases. Otherwise a benchmark result will be provided for the wrong configuration and the result will be misleading. Pull Request resolved: https://github.com/facebook/rocksdb/pull/9741 Test Plan: These now fail: ./db_bench --compaction_fadvice=noney Unknown compaction fadvice:noney ./db_bench --value_size_distribution_type=norma Cannot parse distribution type 'norma' While correct values continue to work: ./db_bench --value_size_distribution_type=normal Initializing RocksDB Options from the specified file Initializing RocksDB Options from command-line flags ./db_bench --compaction_fadvice=none Initializing RocksDB Options from the specified file Initializing RocksDB Options from command-line flags Reviewed By: siying Differential Revision: D35115973 Pulled By: mdcallag fbshipit-source-id: c2b10de5c2d1ea7c7539e676f5bd556351f5d370 --- tools/db_bench_tool.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index 6f36b6d41..91d32e372 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -1644,7 +1644,7 @@ static enum DistributionType StringToDistributionType(const char* ctype) { return kNormal; fprintf(stdout, "Cannot parse distribution type '%s'\n", ctype); - return kFixed; // default value + exit(1); } class BaseDistribution { @@ -8119,6 +8119,7 @@ int db_bench_tool(int argc, char** argv) { else { fprintf(stdout, "Unknown compaction fadvice:%s\n", FLAGS_compaction_fadvice.c_str()); + exit(1); } FLAGS_value_size_distribution_type_e =