Skip to content

Commit

Permalink
Remove more obsolete statistics (#11131)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: facebook/rocksdb#11131

Test Plan: `make check`

Reviewed By: pdillinger

Differential Revision: D42753997

Pulled By: ltamasi

fbshipit-source-id: ce8b84c1e55374257e93ed74fd255c9b759723ce
  • Loading branch information
ltamasi authored and facebook-github-bot committed Jan 25, 2023
1 parent 88edfbf commit 6da2e20
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 139 deletions.
2 changes: 1 addition & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Remove deprecated Env::LoadEnv(). Use Env::CreateFromString() instead.

### Public API Changes
* Completely removed the following deprecated/obsolete statistics: `STALL_L0_SLOWDOWN_MICROS`, `STALL_MEMTABLE_COMPACTION_MICROS`, `STALL_L0_NUM_FILES_MICROS`, `NO_ITERATORS`, `BLOB_DB_GC_NUM_KEYS_OVERWRITTEN`, `BLOB_DB_GC_NUM_KEYS_EXPIRED`, `BLOB_DB_GC_BYTES_OVERWRITTEN`, `BLOB_DB_GC_BYTES_EXPIRED`, `BLOB_DB_GC_MICROS`, and `NUM_DATA_BLOCKS_READ_PER_LEVEL`.
* Completely removed the following deprecated/obsolete statistics: the tickers `BLOCK_CACHE_INDEX_BYTES_EVICT`, `BLOCK_CACHE_FILTER_BYTES_EVICT`, `BLOOM_FILTER_MICROS`, `NO_FILE_CLOSES`, `STALL_L0_SLOWDOWN_MICROS`, `STALL_MEMTABLE_COMPACTION_MICROS`, `STALL_L0_NUM_FILES_MICROS`, `RATE_LIMIT_DELAY_MILLIS`, `NO_ITERATORS`, `NUMBER_FILTERED_DELETES`, `WRITE_TIMEDOUT`, `BLOB_DB_GC_NUM_KEYS_OVERWRITTEN`, `BLOB_DB_GC_NUM_KEYS_EXPIRED`, `BLOB_DB_GC_BYTES_OVERWRITTEN`, `BLOB_DB_GC_BYTES_EXPIRED`, `BLOCK_CACHE_COMPRESSION_DICT_BYTES_EVICT`, `STALL_L0_SLOWDOWN_COUNT`, `STALL_MEMTABLE_COMPACTION_COUNT`, `STALL_L0_NUM_FILES_COUNT`, `HARD_RATE_LIMIT_DELAY_COUNT`, and `SOFT_RATE_LIMIT_DELAY_COUNT` as well as the histograms `BLOB_DB_GC_MICROS` and `NUM_DATA_BLOCKS_READ_PER_LEVEL`. Note that as a result, the C++ enum values of the still supported statistics have changed. Developers are advised to not rely on the actual numeric values.

## 7.10.0 (01/23/2023)
### Behavior changes
Expand Down
12 changes: 0 additions & 12 deletions db/db_block_cache_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -422,11 +422,6 @@ TEST_F(DBBlockCacheTest, IndexAndFilterBlocksStats) {
ASSERT_EQ(cache->GetUsage(), index_bytes_insert + filter_bytes_insert);
// set the cache capacity to the current usage
cache->SetCapacity(index_bytes_insert + filter_bytes_insert);
// The index and filter eviction statistics were broken by the refactoring
// that moved the readers out of the block cache. Disabling these until we can
// bring the stats back.
// ASSERT_EQ(TestGetTickerCount(options, BLOCK_CACHE_INDEX_BYTES_EVICT), 0);
// ASSERT_EQ(TestGetTickerCount(options, BLOCK_CACHE_FILTER_BYTES_EVICT), 0);
// Note that the second key needs to be no longer than the first one.
// Otherwise the second index block may not fit in cache.
ASSERT_OK(Put(1, "key", "val"));
Expand All @@ -437,13 +432,6 @@ TEST_F(DBBlockCacheTest, IndexAndFilterBlocksStats) {
index_bytes_insert);
ASSERT_GT(TestGetTickerCount(options, BLOCK_CACHE_FILTER_BYTES_INSERT),
filter_bytes_insert);
// The index and filter eviction statistics were broken by the refactoring
// that moved the readers out of the block cache. Disabling these until we can
// bring the stats back.
// ASSERT_EQ(TestGetTickerCount(options, BLOCK_CACHE_INDEX_BYTES_EVICT),
// index_bytes_insert);
// ASSERT_EQ(TestGetTickerCount(options, BLOCK_CACHE_FILTER_BYTES_EVICT),
// filter_bytes_insert);
}

#if (defined OS_LINUX || defined OS_WIN)
Expand Down
4 changes: 0 additions & 4 deletions db/db_iterator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2229,7 +2229,6 @@ TEST_P(DBIteratorTest, ReadAhead) {
size_t bytes_read = env_->random_read_bytes_counter_;
delete iter;

int64_t num_file_closes = TestGetTickerCount(options, NO_FILE_CLOSES);
env_->random_read_bytes_counter_ = 0;
options.statistics->setTickerCount(NO_FILE_OPENS, 0);
read_options.readahead_size = 1024 * 10;
Expand All @@ -2238,10 +2237,7 @@ TEST_P(DBIteratorTest, ReadAhead) {
int64_t num_file_opens_readahead = TestGetTickerCount(options, NO_FILE_OPENS);
size_t bytes_read_readahead = env_->random_read_bytes_counter_;
delete iter;
int64_t num_file_closes_readahead =
TestGetTickerCount(options, NO_FILE_CLOSES);
ASSERT_EQ(num_file_opens, num_file_opens_readahead);
ASSERT_EQ(num_file_closes, num_file_closes_readahead);
ASSERT_GT(bytes_read_readahead, bytes_read);
ASSERT_GT(bytes_read_readahead, read_options.readahead_size * 3);

Expand Down
46 changes: 16 additions & 30 deletions include/rocksdb/statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
namespace ROCKSDB_NAMESPACE {

/**
* Keep adding tickers here.
* 1. Any ticker should be added immediately before TICKER_ENUM_MAX, taking
* over its old value.
* Keep adding tickers here. Note that the C++ enum values, unlike the values in
* the Java bindings, are not guaranteed to be stable; also, the C++ and Java
* values for any given ticker are not guaranteed to match.
* 1. Add the new ticker before TICKER_ENUM_MAX.
* 2. Add a readable string in TickersNameMap below for the newly added ticker.
* 3. Add a corresponding enum value to TickerType.java in the java API
* 4. Add the enum conversions from Java and C++ to portal.h's toJavaTickerType
* and toCppTickers
* 3. Add a corresponding enum value to TickerType.java in the Java API.
* 4. Add the enum conversions from/to Java/C++ to portal.h's toJavaTickerType
* and toCppTickers.
*/
enum Tickers : uint32_t {
// total block cache misses
Expand All @@ -50,8 +51,6 @@ enum Tickers : uint32_t {
BLOCK_CACHE_INDEX_ADD,
// # of bytes of index blocks inserted into cache
BLOCK_CACHE_INDEX_BYTES_INSERT,
// # of bytes of index block erased from cache
BLOCK_CACHE_INDEX_BYTES_EVICT,
// # of times cache miss when accessing filter block from block cache.
BLOCK_CACHE_FILTER_MISS,
// # of times cache hit when accessing filter block from block cache.
Expand All @@ -60,8 +59,6 @@ enum Tickers : uint32_t {
BLOCK_CACHE_FILTER_ADD,
// # of bytes of bloom filter blocks inserted into cache
BLOCK_CACHE_FILTER_BYTES_INSERT,
// # of bytes of bloom filter block erased from cache
BLOCK_CACHE_FILTER_BYTES_EVICT,
// # of times cache miss when accessing data block from block cache.
BLOCK_CACHE_DATA_MISS,
// # of times cache hit when accessing data block from block cache.
Expand All @@ -83,8 +80,6 @@ enum Tickers : uint32_t {
// exist.
BLOOM_FILTER_FULL_TRUE_POSITIVE,

BLOOM_FILTER_MICROS,

// # persistent cache hit
PERSISTENT_CACHE_HIT,
// # persistent cache miss
Expand Down Expand Up @@ -147,24 +142,19 @@ enum Tickers : uint32_t {
// The number of uncompressed bytes read from an iterator.
// Includes size of key and value.
ITER_BYTES_READ,
NO_FILE_CLOSES,
NO_FILE_OPENS,
NO_FILE_ERRORS,
// Writer has to wait for compaction or flush to finish.
STALL_MICROS,
// The wait time for db mutex.
// Disabled by default. To enable it set stats level to kAll
DB_MUTEX_WAIT_MICROS,
RATE_LIMIT_DELAY_MILLIS,

// Number of MultiGet calls, keys read, and bytes read
NUMBER_MULTIGET_CALLS,
NUMBER_MULTIGET_KEYS_READ,
NUMBER_MULTIGET_BYTES_READ,

// Number of deletes records that were not required to be
// written to storage because key does not exist
NUMBER_FILTERED_DELETES,
NUMBER_MERGE_FAILURES,

// number of times bloom was checked before creating iterator on a
Expand Down Expand Up @@ -193,7 +183,6 @@ enum Tickers : uint32_t {
// head of the writers queue.
WRITE_DONE_BY_SELF,
WRITE_DONE_BY_OTHER, // Equivalent to writes done for others
WRITE_TIMEDOUT, // Number of writes ending up with timed-out.
WRITE_WITH_WAL, // Number of Write calls that request WAL
COMPACT_READ_BYTES, // Bytes read during compaction
COMPACT_WRITE_BYTES, // Bytes written during compaction
Expand Down Expand Up @@ -343,7 +332,6 @@ enum Tickers : uint32_t {
BLOCK_CACHE_COMPRESSION_DICT_HIT,
BLOCK_CACHE_COMPRESSION_DICT_ADD,
BLOCK_CACHE_COMPRESSION_DICT_BYTES_INSERT,
BLOCK_CACHE_COMPRESSION_DICT_BYTES_EVICT,

// # of blocks redundantly inserted into block cache.
// REQUIRES: BLOCK_CACHE_ADD_REDUNDANT <= BLOCK_CACHE_ADD
Expand Down Expand Up @@ -441,12 +429,15 @@ enum Tickers : uint32_t {
extern const std::vector<std::pair<Tickers, std::string>> TickersNameMap;

/**
* Keep adding histogram's here.
* Any histogram should have value less than HISTOGRAM_ENUM_MAX
* Add a new Histogram by assigning it the current value of HISTOGRAM_ENUM_MAX
* Add a string representation in HistogramsNameMap below
* And increment HISTOGRAM_ENUM_MAX
* Add a corresponding enum value to HistogramType.java in the java API
* Keep adding histograms here. Note that the C++ enum values, unlike the values
* in the Java bindings, are not guaranteed to be stable; also, the C++ and Java
* values for any given histogram are not guaranteed to match.
* 1. Add the new histogram before HISTOGRAM_ENUM_MAX.
* 2. Add a readable string in HistogramsNameMap below for the newly added
* histogram.
* 3. Add a corresponding enum value to HistogramType.java in the Java API.
* 4. Add the enum conversions from/to Java/C++ to portal.h's
* toJavaHistogramsType and toCppHistograms.
*/
enum Histograms : uint32_t {
DB_GET = 0,
Expand All @@ -464,11 +455,6 @@ enum Histograms : uint32_t {
READ_BLOCK_COMPACTION_MICROS,
READ_BLOCK_GET_MICROS,
WRITE_RAW_BLOCK_MICROS,
STALL_L0_SLOWDOWN_COUNT,
STALL_MEMTABLE_COMPACTION_COUNT,
STALL_L0_NUM_FILES_COUNT,
HARD_RATE_LIMIT_DELAY_COUNT,
SOFT_RATE_LIMIT_DELAY_COUNT,
NUM_FILES_IN_SINGLE_COMPACTION,
DB_SEEK,
WRITE_STALL,
Expand Down
44 changes: 0 additions & 44 deletions java/rocksjni/portal.h
Original file line number Diff line number Diff line change
Expand Up @@ -4806,8 +4806,6 @@ class TickerTypeJni {
return 0x6;
case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_INDEX_BYTES_INSERT:
return 0x7;
case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_INDEX_BYTES_EVICT:
return 0x8;
case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_FILTER_MISS:
return 0x9;
case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_FILTER_HIT:
Expand All @@ -4816,8 +4814,6 @@ class TickerTypeJni {
return 0xB;
case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_FILTER_BYTES_INSERT:
return 0xC;
case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_FILTER_BYTES_EVICT:
return 0xD;
case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_DATA_MISS:
return 0xE;
case ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_DATA_HIT:
Expand Down Expand Up @@ -4884,8 +4880,6 @@ class TickerTypeJni {
return 0x2D;
case ROCKSDB_NAMESPACE::Tickers::ITER_BYTES_READ:
return 0x2E;
case ROCKSDB_NAMESPACE::Tickers::NO_FILE_CLOSES:
return 0x2F;
case ROCKSDB_NAMESPACE::Tickers::NO_FILE_OPENS:
return 0x30;
case ROCKSDB_NAMESPACE::Tickers::NO_FILE_ERRORS:
Expand All @@ -4894,16 +4888,12 @@ class TickerTypeJni {
return 0x35;
case ROCKSDB_NAMESPACE::Tickers::DB_MUTEX_WAIT_MICROS:
return 0x36;
case ROCKSDB_NAMESPACE::Tickers::RATE_LIMIT_DELAY_MILLIS:
return 0x37;
case ROCKSDB_NAMESPACE::Tickers::NUMBER_MULTIGET_CALLS:
return 0x39;
case ROCKSDB_NAMESPACE::Tickers::NUMBER_MULTIGET_KEYS_READ:
return 0x3A;
case ROCKSDB_NAMESPACE::Tickers::NUMBER_MULTIGET_BYTES_READ:
return 0x3B;
case ROCKSDB_NAMESPACE::Tickers::NUMBER_FILTERED_DELETES:
return 0x3C;
case ROCKSDB_NAMESPACE::Tickers::NUMBER_MERGE_FAILURES:
return 0x3D;
case ROCKSDB_NAMESPACE::Tickers::BLOOM_FILTER_PREFIX_CHECKED:
Expand All @@ -4930,8 +4920,6 @@ class TickerTypeJni {
return 0x48;
case ROCKSDB_NAMESPACE::Tickers::WRITE_DONE_BY_OTHER:
return 0x49;
case ROCKSDB_NAMESPACE::Tickers::WRITE_TIMEDOUT:
return 0x4A;
case ROCKSDB_NAMESPACE::Tickers::WRITE_WITH_WAL:
return 0x4B;
case ROCKSDB_NAMESPACE::Tickers::COMPACT_READ_BYTES:
Expand Down Expand Up @@ -5175,8 +5163,6 @@ class TickerTypeJni {
return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_INDEX_ADD;
case 0x7:
return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_INDEX_BYTES_INSERT;
case 0x8:
return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_INDEX_BYTES_EVICT;
case 0x9:
return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_FILTER_MISS;
case 0xA:
Expand All @@ -5185,8 +5171,6 @@ class TickerTypeJni {
return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_FILTER_ADD;
case 0xC:
return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_FILTER_BYTES_INSERT;
case 0xD:
return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_FILTER_BYTES_EVICT;
case 0xE:
return ROCKSDB_NAMESPACE::Tickers::BLOCK_CACHE_DATA_MISS;
case 0xF:
Expand Down Expand Up @@ -5253,8 +5237,6 @@ class TickerTypeJni {
return ROCKSDB_NAMESPACE::Tickers::NUMBER_DB_PREV_FOUND;
case 0x2E:
return ROCKSDB_NAMESPACE::Tickers::ITER_BYTES_READ;
case 0x2F:
return ROCKSDB_NAMESPACE::Tickers::NO_FILE_CLOSES;
case 0x30:
return ROCKSDB_NAMESPACE::Tickers::NO_FILE_OPENS;
case 0x31:
Expand All @@ -5263,16 +5245,12 @@ class TickerTypeJni {
return ROCKSDB_NAMESPACE::Tickers::STALL_MICROS;
case 0x36:
return ROCKSDB_NAMESPACE::Tickers::DB_MUTEX_WAIT_MICROS;
case 0x37:
return ROCKSDB_NAMESPACE::Tickers::RATE_LIMIT_DELAY_MILLIS;
case 0x39:
return ROCKSDB_NAMESPACE::Tickers::NUMBER_MULTIGET_CALLS;
case 0x3A:
return ROCKSDB_NAMESPACE::Tickers::NUMBER_MULTIGET_KEYS_READ;
case 0x3B:
return ROCKSDB_NAMESPACE::Tickers::NUMBER_MULTIGET_BYTES_READ;
case 0x3C:
return ROCKSDB_NAMESPACE::Tickers::NUMBER_FILTERED_DELETES;
case 0x3D:
return ROCKSDB_NAMESPACE::Tickers::NUMBER_MERGE_FAILURES;
case 0x3E:
Expand All @@ -5299,8 +5277,6 @@ class TickerTypeJni {
return ROCKSDB_NAMESPACE::Tickers::WRITE_DONE_BY_SELF;
case 0x49:
return ROCKSDB_NAMESPACE::Tickers::WRITE_DONE_BY_OTHER;
case 0x4A:
return ROCKSDB_NAMESPACE::Tickers::WRITE_TIMEDOUT;
case 0x4B:
return ROCKSDB_NAMESPACE::Tickers::WRITE_WITH_WAL;
case 0x4C:
Expand Down Expand Up @@ -5562,16 +5538,6 @@ class HistogramTypeJni {
return 0xB;
case ROCKSDB_NAMESPACE::Histograms::WRITE_RAW_BLOCK_MICROS:
return 0xC;
case ROCKSDB_NAMESPACE::Histograms::STALL_L0_SLOWDOWN_COUNT:
return 0xD;
case ROCKSDB_NAMESPACE::Histograms::STALL_MEMTABLE_COMPACTION_COUNT:
return 0xE;
case ROCKSDB_NAMESPACE::Histograms::STALL_L0_NUM_FILES_COUNT:
return 0xF;
case ROCKSDB_NAMESPACE::Histograms::HARD_RATE_LIMIT_DELAY_COUNT:
return 0x10;
case ROCKSDB_NAMESPACE::Histograms::SOFT_RATE_LIMIT_DELAY_COUNT:
return 0x11;
case ROCKSDB_NAMESPACE::Histograms::NUM_FILES_IN_SINGLE_COMPACTION:
return 0x12;
case ROCKSDB_NAMESPACE::Histograms::DB_SEEK:
Expand Down Expand Up @@ -5687,16 +5653,6 @@ class HistogramTypeJni {
return ROCKSDB_NAMESPACE::Histograms::READ_BLOCK_GET_MICROS;
case 0xC:
return ROCKSDB_NAMESPACE::Histograms::WRITE_RAW_BLOCK_MICROS;
case 0xD:
return ROCKSDB_NAMESPACE::Histograms::STALL_L0_SLOWDOWN_COUNT;
case 0xE:
return ROCKSDB_NAMESPACE::Histograms::STALL_MEMTABLE_COMPACTION_COUNT;
case 0xF:
return ROCKSDB_NAMESPACE::Histograms::STALL_L0_NUM_FILES_COUNT;
case 0x10:
return ROCKSDB_NAMESPACE::Histograms::HARD_RATE_LIMIT_DELAY_COUNT;
case 0x11:
return ROCKSDB_NAMESPACE::Histograms::SOFT_RATE_LIMIT_DELAY_COUNT;
case 0x12:
return ROCKSDB_NAMESPACE::Histograms::NUM_FILES_IN_SINGLE_COMPACTION;
case 0x13:
Expand Down
10 changes: 0 additions & 10 deletions java/src/main/java/org/rocksdb/HistogramType.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@ public enum HistogramType {

WRITE_RAW_BLOCK_MICROS((byte) 0xC),

STALL_L0_SLOWDOWN_COUNT((byte) 0xD),

STALL_MEMTABLE_COMPACTION_COUNT((byte) 0xE),

STALL_L0_NUM_FILES_COUNT((byte) 0xF),

HARD_RATE_LIMIT_DELAY_COUNT((byte) 0x10),

SOFT_RATE_LIMIT_DELAY_COUNT((byte) 0x11),

NUM_FILES_IN_SINGLE_COMPACTION((byte) 0x12),

DB_SEEK((byte) 0x13),
Expand Down
24 changes: 0 additions & 24 deletions java/src/main/java/org/rocksdb/TickerType.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ public enum TickerType {
*/
BLOCK_CACHE_INDEX_BYTES_INSERT((byte) 0x7),

/**
* # of bytes of index block erased from cache
*/
BLOCK_CACHE_INDEX_BYTES_EVICT((byte) 0x8),

/**
* # of times cache miss when accessing filter block from block cache.
*/
Expand All @@ -87,11 +82,6 @@ public enum TickerType {
*/
BLOCK_CACHE_FILTER_BYTES_INSERT((byte) 0xC),

/**
* # of bytes of bloom filter block erased from cache
*/
BLOCK_CACHE_FILTER_BYTES_EVICT((byte) 0xD),

/**
* # of times cache miss when accessing data block from block cache.
*/
Expand Down Expand Up @@ -269,8 +259,6 @@ public enum TickerType {
*/
ITER_BYTES_READ((byte) 0x2E),

NO_FILE_CLOSES((byte) 0x2F),

NO_FILE_OPENS((byte) 0x30),

NO_FILE_ERRORS((byte) 0x31),
Expand All @@ -287,8 +275,6 @@ public enum TickerType {
*/
DB_MUTEX_WAIT_MICROS((byte) 0x36),

RATE_LIMIT_DELAY_MILLIS((byte) 0x37),

/**
* Number of MultiGet calls.
*/
Expand All @@ -304,11 +290,6 @@ public enum TickerType {
*/
NUMBER_MULTIGET_BYTES_READ((byte) 0x3B),

/**
* Number of deletes records that were not required to be
* written to storage because key does not exist.
*/
NUMBER_FILTERED_DELETES((byte) 0x3C),
NUMBER_MERGE_FAILURES((byte) 0x3D),

/**
Expand Down Expand Up @@ -372,11 +353,6 @@ public enum TickerType {
*/
WRITE_DONE_BY_OTHER((byte) 0x49),

/**
* Number of writes ending up with timed-out.
*/
WRITE_TIMEDOUT((byte) 0x4A),

/**
* Number of Write calls that request WAL.
*/
Expand Down
Loading

0 comments on commit 6da2e20

Please sign in to comment.