Skip to content

Commit

Permalink
Don't reset cursors if no checkpoint created in CM::createSnapshot
Browse files Browse the repository at this point in the history
CM::resetCursor repositions cursors at CheckpointList::begin and updates
the accounting of cursor in checkpoints after a CheckpointList change.

There is no reason for making the call in code paths that don't modify
the CheckpointList.

The call removed was the only one passing 'resetPersistenceCursor =
false' at resetCursor(), so the argument is removed.

Change-Id: I987498742426eb4f2b4939faf7c4509194df6783
Reviewed-on: http://review.couchbase.org/c/kv_engine/+/149375
Reviewed-by: James Harrison <james.harrison@couchbase.com>
Tested-by: Build Bot <build@couchbase.com>
  • Loading branch information
paolococchi authored and jameseh96 committed Mar 24, 2021
1 parent 7e25ae4 commit 321c221
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
11 changes: 3 additions & 8 deletions engines/ep/src/checkpoint_manager.cc
Expand Up @@ -1217,15 +1217,11 @@ void CheckpointManager::clear_UNLOCKED(vbucket_state_t vbState, uint64_t seqno)
maxVisibleSeqno,
{},
CheckpointType::Memory);
resetCursors(true);
resetCursors();
}

void CheckpointManager::resetCursors(bool resetPersistenceCursor) {
void CheckpointManager::resetCursors() {
for (auto& cit : cursors) {
if (cit.second->name == pCursorName && !resetPersistenceCursor) {
continue;
}

// Remove this cursor from the accounting of it's old checkpoint.
(*cit.second->currentCheckpoint)->decNumOfCursorsInCheckpoint();

Expand Down Expand Up @@ -1356,7 +1352,6 @@ void CheckpointManager::createSnapshot(
if (openCkpt.getNumItems() == 0) {
if (openCkptId == 0) {
setOpenCheckpointId_UNLOCKED(lh, openCkptId + 1);
resetCursors(false);
}
openCkpt.setSnapshotStartSeqno(snapStartSeqno);
openCkpt.setSnapshotEndSeqno(snapEndSeqno, visibleSnapEnd);
Expand Down Expand Up @@ -1648,7 +1643,7 @@ void CheckpointManager::takeAndResetCursors(CheckpointManager& other) {
}
other.cursors.clear();

resetCursors(true);
resetCursors();
}

bool CheckpointManager::isOpenCheckpointDisk() {
Expand Down
2 changes: 1 addition & 1 deletion engines/ep/src/checkpoint_manager.h
Expand Up @@ -657,7 +657,7 @@ class CheckpointManager {
bool isCheckpointCreationForHighMemUsage_UNLOCKED(const LockHolder& lh,
const VBucket& vbucket);

void resetCursors(bool resetPersistenceCursor);
void resetCursors();

queued_item createCheckpointItem(uint64_t id,
Vbid vbid,
Expand Down

0 comments on commit 321c221

Please sign in to comment.