From 6904fd0c86958ed5c629274bc94b75c24b83ceb6 Mon Sep 17 00:00:00 2001 From: Mark Callaghan Date: Wed, 23 Mar 2022 12:26:34 -0700 Subject: [PATCH] db_bench should fail when an option uses an invalid compression type (#9729) Summary: This changes db_bench to fail at startup for invalid compression types. It had been changing them to Snappy. For other invalid options it fails at startup. This is for https://github.com/facebook/rocksdb/issues/9621 Pull Request resolved: https://github.com/facebook/rocksdb/pull/9729 Test Plan: This continues to work: ./db_bench --benchmarks=fillrandom --compression_type=lz4 This now fails rather than changing the compression type to Snappy ./db_bench --benchmarks=fillrandom --compression_type=lz44 Cannot parse compression type 'lz44' Reviewed By: jay-zhuang Differential Revision: D35081323 Pulled By: mdcallag fbshipit-source-id: 9b38c835abddce11aa7feb235df63f53cf829981 --- tools/db_bench_tool.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index 10d05b025..c8b74d900 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -1148,9 +1148,10 @@ static enum ROCKSDB_NAMESPACE::CompressionType StringToCompressionType( return ROCKSDB_NAMESPACE::kXpressCompression; else if (!strcasecmp(ctype, "zstd")) return ROCKSDB_NAMESPACE::kZSTD; - - fprintf(stdout, "Cannot parse compression type '%s'\n", ctype); - return ROCKSDB_NAMESPACE::kSnappyCompression; // default value + else { + fprintf(stderr, "Cannot parse compression type '%s'\n", ctype); + exit(1); + } } static std::string ColumnFamilyName(size_t i) {