Skip to content

Commit b5e247a

Browse files
committed
Report HashTable item counts in vbucket-details stat
In addition to the overall vbucket-level item counts, also report how many items, in-memory items and deleted items are in the vbucket's HashTable. These can be useful when debugging issues related to item counts. Change-Id: I19150cfb1945d5abc9f8c176c464cb885ffce8cd Reviewed-on: http://review.couchbase.org/c/kv_engine/+/158100 Tested-by: Build Bot <[email protected]> Reviewed-by: Ben Huddleston <[email protected]>
1 parent 8d2f9ff commit b5e247a

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

engines/ep/docs/stats.org

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,11 @@ The stats below are listed for each vbucket.
543543
| vb_pending_eject | Number of times item values got ejected |
544544
| vb_pending_expired | Number of times an item was expired |
545545
| ht_memory | Memory overhead of the hashtable |
546+
| ht_num_deleted_items | Number of deleted items in the hashtable |
547+
| ht_num_in_memory_items | Number of in-memory items in the hashtable |
548+
| ht_num_in_memory_non_resident_items | Number of in-memory non-resident items (i.e. items which only have their metadata in memory) |
549+
| ht_num_items | Number of items in the hashtable |
550+
| ht_num_temp_items | Number of temporary items in the hashable |
546551
| ht_item_memory | Total item memory |
547552
| ht_cache_size | Total size of cache (Includes non resident |
548553
| | items) |

engines/ep/src/vbucket.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3125,6 +3125,17 @@ void VBucket::_addStats(VBucketStatsDetailLevel detail,
31253125
add_stat,
31263126
c);
31273127
addStat("ht_memory", ht.memorySize(), add_stat, c);
3128+
addStat("ht_num_items", ht.getNumItems(), add_stat, c);
3129+
addStat("ht_num_deleted_items", ht.getNumDeletedItems(), add_stat, c);
3130+
addStat("ht_num_in_memory_items",
3131+
ht.getNumInMemoryItems(),
3132+
add_stat,
3133+
c);
3134+
addStat("ht_num_in_memory_non_resident_items",
3135+
ht.getNumInMemoryNonResItems(),
3136+
add_stat,
3137+
c);
3138+
addStat("ht_num_temp_items", ht.getNumTempItems(), add_stat, c);
31283139
addStat("ht_item_memory", ht.getItemMemory(), add_stat, c);
31293140
addStat("ht_item_memory_uncompressed",
31303141
ht.getUncompressedItemMemory(),

engines/ep/tests/ep_testsuite.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6826,6 +6826,11 @@ static enum test_result test_mb19687_fixed(EngineIface* h) {
68266826
"vb_0:ht_item_memory",
68276827
"vb_0:ht_item_memory_uncompressed",
68286828
"vb_0:ht_memory",
6829+
"vb_0:ht_num_deleted_items",
6830+
"vb_0:ht_num_in_memory_items",
6831+
"vb_0:ht_num_in_memory_non_resident_items",
6832+
"vb_0:ht_num_items",
6833+
"vb_0:ht_num_temp_items",
68296834
"vb_0:ht_size",
68306835
"vb_0:logical_clock_ticks",
68316836
"vb_0:max_cas",

0 commit comments

Comments
 (0)