From 8fc3de3c622896d49480a53eac0ebb20301a645b Mon Sep 17 00:00:00 2001 From: Andrew Kryczka Date: Thu, 21 Sep 2017 11:03:53 -0700 Subject: [PATCH] make rate limiter a general option Summary: it's unsupported in options file, so the flag should be respected by db_bench even when an options file is provided. Closes https://github.com/facebook/rocksdb/pull/2910 Differential Revision: D5869836 Pulled By: ajkr fbshipit-source-id: f67f591ae083e95e989f86b6fad50765d2e3d855 --- tools/db_bench_tool.cc | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index 0f8909543..a23a247fe 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -3212,20 +3212,6 @@ void VerifyDBFromDB(std::string& truth_db_name) { if (FLAGS_thread_status_per_interval > 0) { options.enable_thread_tracking = true; } - if (FLAGS_rate_limiter_bytes_per_sec > 0) { - if (FLAGS_rate_limit_bg_reads && - !FLAGS_new_table_reader_for_compaction_inputs) { - fprintf(stderr, - "rate limit compaction reads must have " - "new_table_reader_for_compaction_inputs set\n"); - exit(1); - } - options.rate_limiter.reset(NewGenericRateLimiter( - FLAGS_rate_limiter_bytes_per_sec, 100 * 1000 /* refill_period_us */, - 10 /* fairness */, - FLAGS_rate_limit_bg_reads ? RateLimiter::Mode::kReadsOnly - : RateLimiter::Mode::kWritesOnly)); - } #ifndef ROCKSDB_LITE if (FLAGS_readonly && FLAGS_transaction_db) { @@ -3259,6 +3245,21 @@ void VerifyDBFromDB(std::string& truth_db_name) { } options.env = FLAGS_env; + if (FLAGS_rate_limiter_bytes_per_sec > 0) { + if (FLAGS_rate_limit_bg_reads && + !FLAGS_new_table_reader_for_compaction_inputs) { + fprintf(stderr, + "rate limit compaction reads must have " + "new_table_reader_for_compaction_inputs set\n"); + exit(1); + } + options.rate_limiter.reset(NewGenericRateLimiter( + FLAGS_rate_limiter_bytes_per_sec, 100 * 1000 /* refill_period_us */, + 10 /* fairness */, + FLAGS_rate_limit_bg_reads ? RateLimiter::Mode::kReadsOnly + : RateLimiter::Mode::kWritesOnly)); + } + if (FLAGS_num_multi_db <= 1) { OpenDb(options, FLAGS_db, &db_); } else {