From e66221add4e83fc395eef2adb0989b97aeb92c00 Mon Sep 17 00:00:00 2001 From: Andrew Kryczka Date: Thu, 16 Mar 2017 17:45:28 -0700 Subject: [PATCH] fix db_bench rate limiter callsites Summary: pass nullptr as stats object for db_bench-specific rate limiters since its stats are intended to capture background write activity only. Closes https://github.com/facebook/rocksdb/pull/1997 Differential Revision: D4726806 Pulled By: ajkr fbshipit-source-id: 8e4b225 --- tools/db_bench_tool.cc | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index faa60d38b8..cbb4bce82f 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -3343,8 +3343,8 @@ class Benchmark { if (thread->shared->write_rate_limiter.get() != nullptr) { thread->shared->write_rate_limiter->Request( - entries_per_batch_ * (value_size_ + key_size_), - Env::IO_HIGH); + entries_per_batch_ * (value_size_ + key_size_), Env::IO_HIGH, + nullptr /* stats */); // Set time at which last op finished to Now() to hide latency and // sleep from rate limiter. Also, do the check once per batch, not // once per write. @@ -3704,7 +3704,8 @@ class Benchmark { if (thread->shared->read_rate_limiter.get() != nullptr && i % 1024 == 1023) { - thread->shared->read_rate_limiter->Request(1024, Env::IO_HIGH); + thread->shared->read_rate_limiter->Request(1024, Env::IO_HIGH, + nullptr /* stats */); } } @@ -3735,7 +3736,8 @@ class Benchmark { ++i; if (thread->shared->read_rate_limiter.get() != nullptr && i % 1024 == 1023) { - thread->shared->read_rate_limiter->Request(1024, Env::IO_HIGH); + thread->shared->read_rate_limiter->Request(1024, Env::IO_HIGH, + nullptr /* stats */); } } delete iter; @@ -3776,7 +3778,8 @@ class Benchmark { } } if (thread->shared->read_rate_limiter.get() != nullptr) { - thread->shared->read_rate_limiter->Request(100, Env::IO_HIGH); + thread->shared->read_rate_limiter->Request(100, Env::IO_HIGH, + nullptr /* stats */); } thread->stats.FinishedOps(nullptr, db, 100, kRead); @@ -3860,7 +3863,8 @@ class Benchmark { if (thread->shared->read_rate_limiter.get() != nullptr && read % 256 == 255) { - thread->shared->read_rate_limiter->Request(256, Env::IO_HIGH); + thread->shared->read_rate_limiter->Request(256, Env::IO_HIGH, + nullptr /* stats */); } thread->stats.FinishedOps(db_with_cfh, db_with_cfh->db, 1, kRead); @@ -3915,8 +3919,8 @@ class Benchmark { } if (thread->shared->read_rate_limiter.get() != nullptr && num_multireads % 256 == 255) { - thread->shared->read_rate_limiter->Request(256 * entries_per_batch_, - Env::IO_HIGH); + thread->shared->read_rate_limiter->Request( + 256 * entries_per_batch_, Env::IO_HIGH, nullptr /* stats */); } thread->stats.FinishedOps(nullptr, db, entries_per_batch_, kRead); } @@ -4013,7 +4017,8 @@ class Benchmark { if (thread->shared->read_rate_limiter.get() != nullptr && read % 256 == 255) { - thread->shared->read_rate_limiter->Request(256, Env::IO_HIGH); + thread->shared->read_rate_limiter->Request(256, Env::IO_HIGH, + nullptr /* stats */); } thread->stats.FinishedOps(&db_, db_.db, 1, kSeek); @@ -4143,8 +4148,8 @@ class Benchmark { if (FLAGS_benchmark_write_rate_limit > 0) { write_rate_limiter->Request( - entries_per_batch_ * (value_size_ + key_size_), - Env::IO_HIGH); + entries_per_batch_ * (value_size_ + key_size_), Env::IO_HIGH, + nullptr /* stats */); } } thread->stats.AddBytes(bytes); @@ -4815,7 +4820,8 @@ class Benchmark { found += key_found; if (thread->shared->read_rate_limiter.get() != nullptr) { - thread->shared->read_rate_limiter->Request(1, Env::IO_HIGH); + thread->shared->read_rate_limiter->Request(1, Env::IO_HIGH, + nullptr /* stats */); } } delete iter; @@ -4885,7 +4891,8 @@ class Benchmark { if (FLAGS_benchmark_write_rate_limit > 0) { write_rate_limiter->Request( - entries_per_batch_ * (value_size_ + key_size_), Env::IO_HIGH); + entries_per_batch_ * (value_size_ + key_size_), Env::IO_HIGH, + nullptr /* stats */); } } }