Skip to content

Commit

Permalink
MB-9897: Add a stat that tracks number of dropped cursors
Browse files Browse the repository at this point in the history
Change-Id: Id3fce7daab01ea162385ae3715f625715bcf5e60
Reviewed-on: http://review.couchbase.org/53626
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
  • Loading branch information
abhinavdangeti authored and chiyoung committed Jul 23, 2015
1 parent b98fc82 commit 893a937
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/stats.org
Expand Up @@ -326,6 +326,8 @@ For introductory information on stats within Couchbase, start with the
| | dropping. |
| ep_cursor_dropping_upper_threshold | Memory threshold above which checkpoint|
| | remover will start cursor dropping |
| ep_cursors_dropped | Number of cursors dropped by the |
| | checkpoint remover |


** vBucket total stats
Expand Down
1 change: 1 addition & 0 deletions src/checkpoint_remover.cc
Expand Up @@ -120,6 +120,7 @@ void ClosedUnrefCheckpointRemoverTask::cursorDroppingIfNeeded(void) {
for (; itr != cursors.end(); ++itr) {
if (memoryCleared < amountOfMemoryToClear) {
engine->getDcpConnMap().closeSlowStream(vbid, *itr);
++stats.cursorsDropped;
memoryCleared +=
vb->getChkMgrMemUsageOfUnrefCheckpoints();
} else {
Expand Down
2 changes: 2 additions & 0 deletions src/ep_engine.cc
Expand Up @@ -3538,6 +3538,8 @@ ENGINE_ERROR_CODE EventuallyPersistentEngine::doEngineStats(const void *cookie,
epstats.cursorDroppingLThreshold, add_stat, cookie);
add_casted_stat("ep_cursor_dropping_upper_threshold",
epstats.cursorDroppingUThreshold, add_stat, cookie);
add_casted_stat("ep_cursors_dropped",
epstats.cursorsDropped, add_stat, cookie);

return ENGINE_SUCCESS;
}
Expand Down
4 changes: 4 additions & 0 deletions src/stats.h
Expand Up @@ -79,6 +79,7 @@ class EPStats {
mem_high_wat_percent(0),
cursorDroppingLThreshold(0),
cursorDroppingUThreshold(0),
cursorsDropped(0),
pagerRuns(0),
expiryPagerRuns(0),
itemsRemovedFromCheckpoints(0),
Expand Down Expand Up @@ -267,6 +268,9 @@ class EPStats {
AtomicValue<size_t> cursorDroppingLThreshold;
AtomicValue<size_t> cursorDroppingUThreshold;

//! Number of cursors dropped by checkpoint remover
AtomicValue<size_t> cursorsDropped;

//! Number of times we needed to kick in the pager
AtomicValue<size_t> pagerRuns;
//! Number of times the expiry pager runs for purging expired items
Expand Down

0 comments on commit 893a937

Please sign in to comment.