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
This commit is contained in:
CaixinGong 2020-04-08 14:23:41 -07:00 committed by Facebook GitHub Bot
parent d648a0e17f
commit a91613dd06
1 changed files with 2 additions and 2 deletions

View File

@ -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<const char[]> 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) {