@@ -156,6 +156,7 @@ std::ostream& operator<<(std::ostream& os, const CheckpointCursor& c) {
156156}
157157
158158Checkpoint::Checkpoint (
159+ CheckpointManager& manager,
159160 EPStats& st,
160161 uint64_t id,
161162 uint64_t snapStart,
@@ -165,7 +166,8 @@ Checkpoint::Checkpoint(
165166 Vbid vbid,
166167 CheckpointType checkpointType,
167168 const std::function<void (int64_t )>& memOverheadChangedCallback)
168- : stats(st),
169+ : manager(manager),
170+ stats(st),
169171 checkpointId(id),
170172 snapStartSeqno(snapStart),
171173 snapEndSeqno(snapEnd),
@@ -206,8 +208,7 @@ Checkpoint::~Checkpoint() {
206208 memOverheadChangedCallback (-getMemoryOverhead ());
207209}
208210
209- QueueDirtyResult Checkpoint::queueDirty (const queued_item& qi,
210- CheckpointManager* checkpointManager) {
211+ QueueDirtyResult Checkpoint::queueDirty (const queued_item& qi) {
211212 if (getState () != CHECKPOINT_OPEN) {
212213 throw std::logic_error (
213214 " Checkpoint::queueDirty: checkpointState "
@@ -289,7 +290,7 @@ QueueDirtyResult Checkpoint::queueDirty(const queued_item& qi,
289290 // this Checkpoint and see if the existing item for this key is
290291 // to the "left" of the cursor (i.e. has already been
291292 // processed).
292- for (auto & cursor : checkpointManager-> cursors ) {
293+ for (auto & cursor : manager. cursors ) {
293294 if ((*(cursor.second ->currentCheckpoint )).get () != this ) {
294295 // Cursor is in another checkpoint, doesn't need
295296 // updating here
@@ -346,20 +347,16 @@ QueueDirtyResult Checkpoint::queueDirty(const queued_item& qi,
346347 // a single item (we de-dupe below). Track this in an
347348 // AggregatedFlushStats in CheckpointManager so that we can
348349 // undo these stat updates if the flush fails.
349- auto backupPCursor = checkpointManager-> cursors .find (
350+ auto backupPCursor = manager. cursors .find (
350351 CheckpointManager::backupPCursorName);
351352
352- if (backupPCursor == checkpointManager-> cursors .end ()) {
353+ if (backupPCursor == manager. cursors .end ()) {
353354 decrCursorIfSameKey ();
354355
355356 // We're not mid-flush, don't need to adjust any stats
356357 continue ;
357358 }
358359
359- // We'd normally use "mutation_id" here which is basically
360- // the seqno but the backupPCursor may be in a different
361- // checkpoint and we'd fail a bunch of sanity checks trying
362- // to read it.
363360 auto backupPCursorSeqno =
364361 (*(*backupPCursor->second ).currentPos )
365362 ->getBySeqno ();
@@ -368,8 +365,8 @@ QueueDirtyResult Checkpoint::queueDirty(const queued_item& qi,
368365 // the stats we'll use the new item and the flush
369366 // will pick up the new item too so we have to match
370367 // the original (oldItem) increment with a decrement
371- checkpointManager-> persistenceFailureStatOvercounts
372- . accountItem ( *oldItem);
368+ manager. persistenceFailureStatOvercounts . accountItem (
369+ *oldItem);
373370 }
374371
375372 decrCursorIfSameKey ();
@@ -457,7 +454,7 @@ QueueDirtyResult Checkpoint::queueDirty(const queued_item& qi,
457454 if (qi->getOperation () == queue_op::checkpoint_start ||
458455 qi->getOperation () == queue_op::checkpoint_end ||
459456 qi->getOperation () == queue_op::set_vbucket_state) {
460- checkpointManager-> notifyFlusher ();
457+ manager. notifyFlusher ();
461458 }
462459
463460 return rv;
0 commit comments