Skip to content

Commit

Permalink
Merge "Merge branch 'neo'"
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit Code Review committed Jun 23, 2022
2 parents 5225bea + e595bba commit 2dd20ef
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
8 changes: 8 additions & 0 deletions engines/ep/src/durability/durability_monitor_impl.h
Expand Up @@ -836,6 +836,14 @@ struct PassiveDurabilityMonitor::State {
*/
void checkForAndRemoveDroppedCollections();

/**
* Track the snapshot end (a boundary at which we can move the HPS) and move
* the HPS if appropriate.
* @param type Type of Checkpoint
* @param snapEnd The snapshot end
*/
void processSnapshotEnd(CheckpointType type, uint64_t snapEnd);

/**
* Erase the SyncWrite at the given iterator after fixing up the iterators
* for the HCS and HPS values (if they point to the element to be erased)
Expand Down
22 changes: 14 additions & 8 deletions engines/ep/src/durability/passive_durability_monitor.cc
Expand Up @@ -242,15 +242,12 @@ size_t PassiveDurabilityMonitor::getNumAborted() const {
void PassiveDurabilityMonitor::notifySnapshotEndReceived(uint64_t snapEnd) {
{ // state locking scope
auto s = state.wlock();
s->receivedSnapshotEnds.push({int64_t(snapEnd),
vb.isReceivingDiskSnapshot()
? CheckpointType::Disk
: CheckpointType::Memory});
// Maybe the new tracked Prepare is already satisfied and could be
// ack'ed back to the Active.

auto prevHps = s->highPreparedSeqno.lastWriteSeqno;
s->updateHighPreparedSeqno();
s->checkForAndRemoveDroppedCollections();
s->processSnapshotEnd(vb.isReceivingDiskSnapshot()
? CheckpointType::Disk
: CheckpointType::Memory,
snapEnd);

// Store the seqno ack to send after we drop the state lock
storeSeqnoAck(prevHps, s->highPreparedSeqno.lastWriteSeqno);
Expand Down Expand Up @@ -805,6 +802,15 @@ void PassiveDurabilityMonitor::State::checkForAndRemoveDroppedCollections() {
}
}

void PassiveDurabilityMonitor::State::processSnapshotEnd(CheckpointType type,
uint64_t snapEnd) {
receivedSnapshotEnds.push({int64_t(snapEnd), type});
// Maybe the new tracked Prepare is already satisfied and could be
// ack'ed back to the Active.
updateHighPreparedSeqno();
checkForAndRemoveDroppedCollections();
}

template <class exception>
[[noreturn]] void PassiveDurabilityMonitor::throwException(
const std::string& thrower, const std::string& error) const {
Expand Down

0 comments on commit 2dd20ef

Please sign in to comment.