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
main
Mark Callaghan 3 years ago committed by Facebook GitHub Bot
parent 91687d70ea
commit 6904fd0c86
  1. 7
      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) {

Loading…
Cancel
Save