Skip to content

Commit ff66224

Browse files
BenHuddlestondaverigby
authored andcommitted
MB-45459: Pass old item to persistenceFailureStatOvercounts
Currently we pass the old queue time to the persistenceFailureStatOvercounts stats (stat changes applied if a flush fails) which is required as the queue time may change for the next item flushed. The same issue exists for dirtyQueuePendingWrites which may change if the item changes size. Pass the entire old item to the persistenceFailureStatOvercounts instead. Change-Id: I9caa796522b876a5b6d96685832951aac0d8579c Reviewed-on: http://review.couchbase.org/c/kv_engine/+/151033 Tested-by: Build Bot <[email protected]> Reviewed-by: Dave Rigby <[email protected]>
1 parent 0b3337d commit ff66224

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

engines/ep/src/checkpoint.cc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,12 @@ QueueDirtyResult Checkpoint::queueDirty(const queued_item& qi,
352352
(*(*backupPCursor->second).currentPos)
353353
->getBySeqno();
354354
if (backupPCursorSeqno <= currMutationId) {
355-
// Pass the old queueTime in. When we return and update
356-
// the stats we'll use the new queueTime and the flush
357-
// will pick up the new queueTime too so we need to
358-
// patch the increment of the original stat
359-
// update/queueTime
355+
// Pass the oldItem in. When we return and update
356+
// the stats we'll use the new item and the flush
357+
// will pick up the new item too so we have to match
358+
// the original (oldItem) increment with a decrement
360359
checkpointManager->persistenceFailureStatOvercounts
361-
.accountItem(*qi, oldItem->getQueuedTime());
360+
.accountItem(*oldItem);
362361
}
363362

364363
decrCursorIfSameKey();

engines/ep/tests/module_tests/evp_store_single_threaded_test.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7057,7 +7057,7 @@ TEST_P(STParamCouchstoreBucketTest,
70577057
kvstore->setPostFlushHook([this, &vb]() {
70587058
store_item(vbid,
70597059
makeStoredDocKey("keyA"),
7060-
"value",
7060+
"biggerValue",
70617061
0 /*exptime*/,
70627062
{cb::engine_errc::success} /*expected*/,
70637063
PROTOCOL_BINARY_RAW_BYTES);
@@ -7084,6 +7084,7 @@ TEST_P(STParamCouchstoreBucketTest,
70847084
EXPECT_EQ(0, vb.dirtyQueueSize);
70857085
EXPECT_EQ(0, vb.dirtyQueueAge);
70867086
EXPECT_EQ(0, vb.dirtyQueueMem);
7087+
EXPECT_EQ(0, vb.dirtyQueuePendingWrites);
70877088
}
70887089

70897090
TEST_P(STParameterizedBucketTest, CkptMgrDedupeStatsCorrectSmallToLarge) {

0 commit comments

Comments
 (0)