BYTES_READ stats miscount for NotFound cases (#4938)

Summary:
In NotFound cases, stats BYTES_READ and perf_context.get_read_bytes is still be increased. The amount increased will be
whatever size of the string or PinnableSlice that users passed in as the output data structure. This is wrong. Fix this by not
increasing these two counters.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4938

Differential Revision: D13908963

Pulled By: siying

fbshipit-source-id: 60bce42e4fbb9862bba3da36dbc27b2963ea6162
This commit is contained in:
Siying Dong 2019-02-05 10:27:40 -08:00 committed by Facebook Github Bot
parent 31221bb7e8
commit 8fe073324f

View File

@ -1319,10 +1319,13 @@ Status DBImpl::GetImpl(const ReadOptions& read_options,
ReturnAndCleanupSuperVersion(cfd, sv); ReturnAndCleanupSuperVersion(cfd, sv);
RecordTick(stats_, NUMBER_KEYS_READ); RecordTick(stats_, NUMBER_KEYS_READ);
size_t size = pinnable_val->size(); size_t size = 0;
RecordTick(stats_, BYTES_READ, size); if (s.ok()) {
size = pinnable_val->size();
RecordTick(stats_, BYTES_READ, size);
PERF_COUNTER_ADD(get_read_bytes, size);
}
MeasureTime(stats_, BYTES_PER_READ, size); MeasureTime(stats_, BYTES_PER_READ, size);
PERF_COUNTER_ADD(get_read_bytes, size);
} }
return s; return s;
} }