summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2020-05-12 17:16:32 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-12 21:27:34 +0000
commitc48086529bef73468c7840fc4f12d6680b5243f3 (patch)
treea341451f2a4e7d9c713123fcbc3f2575dc55a1c6 /src
parentdd73e5e051e63360036b368135bd7f56a538c0a2 (diff)
downloadmongo-c48086529bef73468c7840fc4f12d6680b5243f3.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 c68a391f8f1ce0390ee019997625c06eb43aea6b.
Diffstat (limited to 'src')
-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;
}