Add a stat for MultiGet keys found, update memtable hit/miss stats
Summary: 1. Add a new ticker stat rocksdb.number.multiget.keys.found to track the number of keys successfully read 2. Update rocksdb.memtable.hit/miss in DBImpl::MultiGet(). It was being done in DBImpl::GetImpl(), but not MultiGet Closes https://github.com/facebook/rocksdb/pull/3730 Differential Revision: D7677364 Pulled By: anand1976 fbshipit-source-id: af22bd0ef8ddc5cf2b4244b0a024e539fe48bca5
This commit is contained in:
parent
c3d1e36cce
commit
dbdaa4662e
@ -3,6 +3,7 @@
|
||||
### Public API Change
|
||||
* Add a BlockBasedTableOption to align uncompressed data blocks on the smaller of block size or page size boundary, to reduce flash reads by avoiding reads spanning 4K pages.
|
||||
* The background thread naming convention changed (on supporting platforms) to "rocksdb:<thread pool priority><thread number>", e.g., "rocksdb:low0".
|
||||
* Add a new ticker stat rocksdb.number.multiget.keys.found to count number of keys successfully read in MultiGet calls
|
||||
|
||||
### New Features
|
||||
* Introduce TTL for level compaction so that all files older than ttl go through the compaction process to get rid of old data.
|
||||
|
@ -1164,6 +1164,7 @@ std::vector<Status> DBImpl::MultiGet(
|
||||
// First look in the memtable, then in the immutable memtable (if any).
|
||||
// s is both in/out. When in, s could either be OK or MergeInProgress.
|
||||
// merge_operands will contain the sequence of merges in the latter case.
|
||||
size_t num_found = 0;
|
||||
for (size_t i = 0; i < num_keys; ++i) {
|
||||
merge_context.Clear();
|
||||
Status& s = stat_list[i];
|
||||
@ -1185,11 +1186,11 @@ std::vector<Status> DBImpl::MultiGet(
|
||||
if (super_version->mem->Get(lkey, value, &s, &merge_context,
|
||||
&range_del_agg, read_options)) {
|
||||
done = true;
|
||||
// TODO(?): RecordTick(stats_, MEMTABLE_HIT)?
|
||||
RecordTick(stats_, MEMTABLE_HIT);
|
||||
} else if (super_version->imm->Get(lkey, value, &s, &merge_context,
|
||||
&range_del_agg, read_options)) {
|
||||
done = true;
|
||||
// TODO(?): RecordTick(stats_, MEMTABLE_HIT)?
|
||||
RecordTick(stats_, MEMTABLE_HIT);
|
||||
}
|
||||
}
|
||||
if (!done) {
|
||||
@ -1198,11 +1199,12 @@ std::vector<Status> DBImpl::MultiGet(
|
||||
super_version->current->Get(read_options, lkey, &pinnable_val, &s,
|
||||
&merge_context, &range_del_agg);
|
||||
value->assign(pinnable_val.data(), pinnable_val.size());
|
||||
// TODO(?): RecordTick(stats_, MEMTABLE_MISS)?
|
||||
RecordTick(stats_, MEMTABLE_MISS);
|
||||
}
|
||||
|
||||
if (s.ok()) {
|
||||
bytes_read += value->size();
|
||||
num_found++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1230,6 +1232,7 @@ std::vector<Status> DBImpl::MultiGet(
|
||||
|
||||
RecordTick(stats_, NUMBER_MULTIGET_CALLS);
|
||||
RecordTick(stats_, NUMBER_MULTIGET_KEYS_READ, num_keys);
|
||||
RecordTick(stats_, NUMBER_MULTIGET_KEYS_FOUND, num_found);
|
||||
RecordTick(stats_, NUMBER_MULTIGET_BYTES_READ, bytes_read);
|
||||
MeasureTime(stats_, BYTES_PER_MULTIGET, bytes_read);
|
||||
PERF_COUNTER_ADD(multiget_read_bytes, bytes_read);
|
||||
|
@ -320,6 +320,9 @@ enum Tickers : uint32_t {
|
||||
// # of times snapshot_mutex_ is acquired in the fast path.
|
||||
TXN_SNAPSHOT_MUTEX_OVERHEAD,
|
||||
|
||||
// Number of keys actually found in MultiGet calls (vs number requested by caller)
|
||||
// NUMBER_MULTIGET_KEYS_READ gives the number requested by caller
|
||||
NUMBER_MULTIGET_KEYS_FOUND,
|
||||
TICKER_ENUM_MAX
|
||||
};
|
||||
|
||||
@ -471,6 +474,7 @@ const std::vector<std::pair<Tickers, std::string>> TickersNameMap = {
|
||||
"rocksdb.txn.overhead.mutex.old.commit.map"},
|
||||
{TXN_DUPLICATE_KEY_OVERHEAD, "rocksdb.txn.overhead.duplicate.key"},
|
||||
{TXN_SNAPSHOT_MUTEX_OVERHEAD, "rocksdb.txn.overhead.mutex.snapshot"},
|
||||
{NUMBER_MULTIGET_KEYS_FOUND, "rocksdb.number.multiget.keys.found"},
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -3295,8 +3295,10 @@ class TickerTypeJni {
|
||||
return 0x5C;
|
||||
case rocksdb::Tickers::NUMBER_ITER_SKIP:
|
||||
return 0x5D;
|
||||
case rocksdb::Tickers::TICKER_ENUM_MAX:
|
||||
case rocksdb::Tickers::NUMBER_MULTIGET_KEYS_FOUND:
|
||||
return 0x5E;
|
||||
case rocksdb::Tickers::TICKER_ENUM_MAX:
|
||||
return 0x5F;
|
||||
|
||||
default:
|
||||
// undefined/default
|
||||
@ -3497,6 +3499,8 @@ class TickerTypeJni {
|
||||
case 0x5D:
|
||||
return rocksdb::Tickers::NUMBER_ITER_SKIP;
|
||||
case 0x5E:
|
||||
return rocksdb::Tickers::NUMBER_MULTIGET_KEYS_FOUND;
|
||||
case 0x5F:
|
||||
return rocksdb::Tickers::TICKER_ENUM_MAX;
|
||||
|
||||
default:
|
||||
|
@ -465,7 +465,17 @@ public enum TickerType {
|
||||
*/
|
||||
NUMBER_RATE_LIMITER_DRAINS((byte) 0x5C),
|
||||
|
||||
TICKER_ENUM_MAX((byte) 0x5D);
|
||||
/**
|
||||
* Number of internal skipped during iteration
|
||||
*/
|
||||
NUMBER_ITER_SKIP((byte) 0x5D),
|
||||
|
||||
/**
|
||||
* Number of MultiGet keys found (vs number requested)
|
||||
*/
|
||||
NUMBER_MULTIGET_KEYS_FOUND((byte) 0x5E),
|
||||
|
||||
TICKER_ENUM_MAX((byte) 0x5F);
|
||||
|
||||
|
||||
private final byte value;
|
||||
|
Loading…
Reference in New Issue
Block a user