summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2020-05-12 17:16:00 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-12 21:29:33 +0000
commit29e8bc79aa7d333bec3dfaa0f4a6d003c8a50e14 (patch)
treeae89369a2d2a23a2d7198f425e5072073a64c456
parent79e004404e09c74d402d0b6d4604a48f1e2ca88d (diff)
downloadmongo-29e8bc79aa7d333bec3dfaa0f4a6d003c8a50e14.tar.gz
Revert "SERVER-47681 Background validation uses the kNoOverlap read source instead of kAllDurableSnapshot to prevent us from having to take the PBWM lock on secondaries"
This reverts commit 1f6db03c2b428a96215d407030fa7c1650456263.
-rw-r--r--src/mongo/db/catalog/validate_state.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/mongo/db/catalog/validate_state.cpp b/src/mongo/db/catalog/validate_state.cpp
index 471b1a759a5..e3aaf085d76 100644
--- a/src/mongo/db/catalog/validate_state.cpp
+++ b/src/mongo/db/catalog/validate_state.cpp
@@ -66,9 +66,7 @@ ValidateState::ValidateState(OperationContext* opCtx,
if (_background) {
// We need to hold the global lock throughout the entire validation to avoid having to save
// and restore our cursors used throughout. This is done in order to avoid abandoning the
- // snapshot and invalidating our cursors. Avoid taking the PBWM lock, which will stall
- // replication if this is a secondary node being validated.
- ShouldNotConflictWithSecondaryBatchApplicationBlock noConflict(opCtx->lockState());
+ // snapshot and invalidating our cursors.
_globalLock.emplace(opCtx, MODE_IS);
_databaseLock.emplace(opCtx, _nss.db(), MODE_IS);
_collectionLock.emplace(opCtx, _nss, MODE_IS);
@@ -149,20 +147,18 @@ void ValidateState::initializeCursors(OperationContext* opCtx) {
invariant(!_traverseRecordStoreCursor && !_seekRecordStoreCursor && _indexCursors.size() == 0 &&
_indexes.size() == 0);
- // Background validation will read from a snapshot opened on the kNoOverlap read source, which
- // is the minimum of the last applied and all durable timestamps, instead of the latest data.
- // Using the kNoOverlap read source prevents us from having to take the PBWM lock, which blocks
- // replication. We cannot solely rely on the all durable timestamp as it can be set while we're
- // in the middle of applying a batch on secondary nodes.
+ // Background validation will read from a snapshot opened on the all durable timestamp instead
+ // of the latest data. This allows concurrent writes to go ahead without interfering with
+ // validation's view of the data.
if (_background) {
invariant(!opCtx->lockState()->isCollectionLockedForMode(_nss, MODE_X));
opCtx->recoveryUnit()->abandonSnapshot();
- // Background validation is expecting to read from the no overlap timestamp, but
+ // Background validation is expecting to read from the all durable timestamp, but
// standalones do not support timestamps. Therefore, if this process is currently running as
// a standalone, don't use a timestamp.
RecoveryUnit::ReadSource rs;
if (repl::ReplicationCoordinator::get(opCtx)->isReplEnabled()) {
- rs = RecoveryUnit::ReadSource::kNoOverlap;
+ rs = RecoveryUnit::ReadSource::kAllDurableSnapshot;
} else {
rs = RecoveryUnit::ReadSource::kNoTimestamp;
}