mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-26 07:30:54 +00:00
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
This commit is contained in:
parent
1480e6f7cf
commit
8fc3de3c62
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue