row_cache: Add metrics for operations on underlying reader

This commit is contained in:
Tomasz Grabiec
2017-07-03 14:04:36 +02:00
parent 5c7b6fc164
commit 6a22cbceaf
3 changed files with 17 additions and 2 deletions

View File

@@ -71,6 +71,9 @@ public:
_range = std::move(*new_range);
_last_key = {};
}
if (_reader) {
++_cache._tracker._stats.underlying_recreations;
}
auto& snap = _cache.snapshot_for_phase(phase);
_reader = _cache.create_underlying_reader(_read_context, snap, _range);
_reader_creation_phase = phase;
@@ -90,8 +93,13 @@ public:
_range = std::move(range);
_last_key = { };
_new_last_key = { };
if (_reader && _reader_creation_phase == phase) {
return _reader->fast_forward_to(_range);
if (_reader) {
if (_reader_creation_phase == phase) {
++_cache._tracker._stats.underlying_partition_skips;
return _reader->fast_forward_to(_range);
} else {
++_cache._tracker._stats.underlying_recreations;
}
}
_reader = _cache.create_underlying_reader(_read_context, snapshot, _range);
_reader_creation_phase = phase;
@@ -211,6 +219,7 @@ public:
// Fast forwards the underlying streamed_mutation to given range.
future<> fast_forward_to(position_range range) {
return ensure_sm_created().then([this, range = std::move(range)] () mutable {
++_cache._tracker._stats.underlying_row_skips;
return _sm->fast_forward_to(std::move(range));
});
}

View File

@@ -111,6 +111,9 @@ cache_tracker::setup_metrics() {
sm::make_derive("reads", sm::description("number of started reads"), _stats.reads),
sm::make_derive("reads_with_misses", sm::description("number of reads which had to read from sstables"), _stats.reads_with_misses),
sm::make_gauge("active_reads", sm::description("number of currently active reads"), [this] { return _stats.active_reads(); }),
sm::make_derive("sstable_reader_recreations", sm::description("number of times sstable reader was recreated due to memtable flush"), _stats.underlying_recreations),
sm::make_derive("sstable_partition_skips", sm::description("number of times sstable reader was fast forwarded across partitions"), _stats.underlying_partition_skips),
sm::make_derive("sstable_row_skips", sm::description("number of times sstable reader was fast forwarded within a partition"), _stats.underlying_row_skips),
});
}

View File

@@ -200,6 +200,9 @@ public:
uint64_t partitions;
uint64_t modification_count;
uint64_t mispopulations;
uint64_t underlying_recreations;
uint64_t underlying_partition_skips;
uint64_t underlying_row_skips;
uint64_t reads;
uint64_t reads_with_misses;
uint64_t reads_done;