Skip to content

Commit 6b0cc34

Browse files
committed
MB-56094: Dump num-items for all checkpints in CM
Currently we report num_items only for the open checkpoint. Useful information in general, particularly useful when inspecting stats for checkpoints that have been touched by ItemExpel. Note: The CM level 'num_open_checkpoint_items' is now reduntant but used by some ep_testsuite test. I'm removing that in a dedicated patch. Change-Id: Ic4401c9bb65eb26c870df7e6d949e6ab9cd1d728 Reviewed-on: https://review.couchbase.org/c/kv_engine/+/189987 Reviewed-by: Dave Rigby <[email protected]> Tested-by: Build Bot <[email protected]>
1 parent 19fa708 commit 6b0cc34

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

engines/ep/docs/stats.org

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,7 @@ each stat name.
10051005
| num_checkpoint_items | Number of total items in a checkpoint |
10061006
| | datastructure |
10071007
| num_open_checkpoint_items | Number of items in the open checkpoint |
1008+
| | (empty item excluded) |
10081009
| num_checkpoints | Number of all checkpoints in the bucket, |
10091010
| | including all Vbuckets/CMs/Destroyers |
10101011
| num_checkpoints_pending_destruction | Number of checkpoints detached from CMs |
@@ -1034,6 +1035,8 @@ prefixed with the vbucket and the id of the Checkpoint, e.g. "vb_0:id_52:state"
10341035
| mem_usage_key_index_overhead | Bytes consumed by the key index. Accounts |
10351036
| | both struct internals and keys. Computed |
10361037
| | by checkpoint counters |
1038+
| num_items | Number of items queued in the checkpoint |
1039+
| | (empty item excluded) |
10371040

10381041
** Memory Stats
10391042

engines/ep/src/checkpoint.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,13 @@ void Checkpoint::addStats(const AddStatFn& add_stat, CookieIface& cookie) {
654654
getId());
655655
add_casted_stat(
656656
buf.data(), isCheckpointHistorical(historical), add_stat, cookie);
657+
658+
checked_snprintf(buf.data(),
659+
buf.size(),
660+
"vb_%d:id_%" PRIu64 ":num_items",
661+
vbucketId.get(),
662+
getId());
663+
add_casted_stat(buf.data(), getNumItems(), add_stat, cookie);
657664
}
658665

659666
void Checkpoint::detachFromManager() {

engines/ep/tests/ep_testsuite.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6385,7 +6385,8 @@ static enum test_result test_mb19687_fixed(EngineIface* h) {
63856385
"vb_0:id_1:type",
63866386
"vb_0:id_1:historical",
63876387
"vb_0:id_1:visible_snap_end",
6388-
"vb_0:id_1:highest_expelled_seqno"}},
6388+
"vb_0:id_1:highest_expelled_seqno",
6389+
"vb_0:id_1:num_items"}},
63896390
{"checkpoint 0",
63906391
{"vb_0:mem_usage",
63916392
"vb_0:mem_usage_queued_items",
@@ -6408,7 +6409,8 @@ static enum test_result test_mb19687_fixed(EngineIface* h) {
64086409
"vb_0:id_1:type",
64096410
"vb_0:id_1:historical",
64106411
"vb_0:id_1:visible_snap_end",
6411-
"vb_0:id_1:highest_expelled_seqno"}},
6412+
"vb_0:id_1:highest_expelled_seqno",
6413+
"vb_0:id_1:num_items"}},
64126414
{"uuid", {"uuid"}},
64136415
{"kvstore",
64146416
{"rw_0:backend_type",

0 commit comments

Comments
 (0)