From 64dca1fef9bf9a2fbc83835610e0452a696ad288 Mon Sep 17 00:00:00 2001 From: Michael Livshin Date: Sun, 4 Jul 2021 21:01:43 +0300 Subject: [PATCH] memtables: count read row tombstones Refs #7749. Signed-off-by: Michael Livshin --- database.hh | 1 + memtable.cc | 6 +++++- table.cc | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/database.hh b/database.hh index a3900b64ab..91a59b41c6 100644 --- a/database.hh +++ b/database.hh @@ -335,6 +335,7 @@ struct table_stats { int64_t memtable_partition_insertions = 0; int64_t memtable_partition_hits = 0; int64_t memtable_range_tombstone_reads = 0; + int64_t memtable_row_tombstone_reads = 0; mutation_application_stats memtable_app_stats; utils::timed_rate_moving_average_and_histogram reads{256}; utils::timed_rate_moving_average_and_histogram writes{256}; diff --git a/memtable.cc b/memtable.cc index 398bede353..62ba624e40 100644 --- a/memtable.cc +++ b/memtable.cc @@ -380,7 +380,11 @@ class partition_snapshot_read_accounter { public: explicit partition_snapshot_read_accounter(memtable& mt): _mt(mt) {} - void operator()(const clustering_row& cr) {} + void operator()(const clustering_row& cr) { + if (cr.tomb()) { + ++_mt._table_stats.memtable_row_tombstone_reads; + } + } void operator()(const static_row& sr) {} void operator()(const range_tombstone& rt) { ++_mt._table_stats.memtable_range_tombstone_reads; diff --git a/table.cc b/table.cc index 68186bac97..ec1abcced7 100644 --- a/table.cc +++ b/table.cc @@ -680,6 +680,7 @@ void table::set_metrics() { ms::make_counter("memtable_row_writes", _stats.memtable_app_stats.row_writes, ms::description("Number of row writes performed in memtables"))(cf)(ks), ms::make_counter("memtable_row_hits", _stats.memtable_app_stats.row_hits, ms::description("Number of rows overwritten by write operations in memtables"))(cf)(ks), ms::make_counter("memtable_range_tombstone_reads", _stats.memtable_range_tombstone_reads, ms::description("Number of range tombstones read from memtables"))(cf)(ks), + ms::make_counter("memtable_row_tombstone_reads", _stats.memtable_row_tombstone_reads, ms::description("Number of row tombstones read from memtables"))(cf)(ks), ms::make_gauge("pending_tasks", ms::description("Estimated number of tasks pending for this column family"), _stats.pending_flushes)(cf)(ks), ms::make_gauge("live_disk_space", ms::description("Live disk space used"), _stats.live_disk_space_used)(cf)(ks), ms::make_gauge("total_disk_space", ms::description("Total disk space used"), _stats.total_disk_space_used)(cf)(ks),