From a91613dd064fe648afb54baeb5513d1fceff77cd Mon Sep 17 00:00:00 2001 From: CaixinGong Date: Wed, 8 Apr 2020 14:23:41 -0700 Subject: [PATCH] Fix readrandom return NotFound after fillrandom in db_bench (#6665) Summary: This commit is fixing a bug that readrandom test returns many NotFound in db_bench from Version 6.2. Pull Request resolved: https://github.com/facebook/rocksdb/issues/6664 Pull Request resolved: https://github.com/facebook/rocksdb/pull/6665 Reviewed By: cheng-chang Differential Revision: D20911298 Pulled By: ajkr fbshipit-source-id: c2658d4dbb35798ccbf67dff6e64923fb731ef81 --- tools/db_bench_tool.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index aa5ae3998..33313f3c8 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -5040,7 +5040,7 @@ class Benchmark { int64_t found = 0; int64_t bytes = 0; int num_keys = 0; - int64_t key_rand = GetRandomKey(&thread->rand); + int64_t key_rand = 0; ReadOptions options(FLAGS_verify_checksum, true); std::unique_ptr key_guard; Slice key = AllocateKey(&key_guard); @@ -5052,7 +5052,6 @@ class Benchmark { // We use same key_rand as seed for key and column family so that we can // deterministically find the cfh corresponding to a particular key, as it // is done in DoWrite method. - GenerateKeyFromInt(key_rand, FLAGS_num, &key); if (entries_per_batch_ > 1 && FLAGS_multiread_stride) { if (++num_keys == entries_per_batch_) { num_keys = 0; @@ -5067,6 +5066,7 @@ class Benchmark { } else { key_rand = GetRandomKey(&thread->rand); } + GenerateKeyFromInt(key_rand, FLAGS_num, &key); read++; Status s; if (FLAGS_num_column_families > 1) {