From b3ed08129be5014757114f250954a22b240da68a Mon Sep 17 00:00:00 2001 From: Mayank Agarwal Date: Fri, 4 Oct 2013 10:33:28 -0700 Subject: [PATCH] Add a statistic to count the number of calls to GetUpdatesSince Summary: This is useful to keep track of refreshes in transaction log iterator Test Plan: make; db_stress --statistics=1 shows it Reviewers: dhruba, haobo Reviewed By: dhruba CC: leveldb Differential Revision: https://reviews.facebook.net/D13281 --- db/db_impl.cc | 1 + include/rocksdb/statistics.h | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index f16bea5cb..9a451f5d7 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -1092,6 +1092,7 @@ SequenceNumber DBImpl::GetLatestSequenceNumber() { Status DBImpl::GetUpdatesSince(SequenceNumber seq, unique_ptr* iter) { + RecordTick(options_.statistics, GET_UPDATES_SINCE_CALLS); if (seq > last_flushed_sequence_) { return Status::IOError("Requested sequence not yet written in the db"); } diff --git a/include/rocksdb/statistics.h b/include/rocksdb/statistics.h index 766ca13fe..15ffc8553 100644 --- a/include/rocksdb/statistics.h +++ b/include/rocksdb/statistics.h @@ -76,6 +76,10 @@ enum Tickers { // over large number of keys with same userkey. NUMBER_OF_RESEEKS_IN_ITERATION, + // Record the number of calls to GetUpadtesSince. Useful to keep track of + // transaction log iterator refreshes + GET_UPDATES_SINCE_CALLS, + TICKER_ENUM_MAX }; @@ -108,7 +112,8 @@ const std::vector> TickersNameMap = { { SEQUENCE_NUMBER, "rocksdb.sequence.number" }, { BLOOM_FILTER_PREFIX_CHECKED, "rocksdb.bloom.filter.prefix.checked" }, { BLOOM_FILTER_PREFIX_USEFUL, "rocksdb.bloom.filter.prefix.useful" }, - { NUMBER_OF_RESEEKS_IN_ITERATION, "rocksdb.number.reseeks.iteration" } + { NUMBER_OF_RESEEKS_IN_ITERATION, "rocksdb.number.reseeks.iteration" }, + { GET_UPDATES_SINCE_CALLS, "rocksdb.getupdatessince.calls" } }; /**