diff options
author | Dianna Hohensee <dianna.hohensee@mongodb.com> | 2019-09-05 00:23:40 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-09-05 00:23:40 +0000 |
commit | e8e3f6ff2604e33e2d7fe1ec56d6559df066a452 (patch) | |
tree | 287697bc8e92870dea373ad3c70fae82e2e1280c /src/mongo/db/catalog | |
parent | bac2b16a61498a65cbd61da0e15235363e7e77b9 (diff) | |
download | mongo-e8e3f6ff2604e33e2d7fe1ec56d6559df066a452.tar.gz |
SERVER-30357 Allow users to run the validate cmd with {background:true}
Diffstat (limited to 'src/mongo/db/catalog')
-rw-r--r-- | src/mongo/db/catalog/collection_validation.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/collection_validation.cpp b/src/mongo/db/catalog/collection_validation.cpp index 40c1a3e567e..e1a08a705c0 100644 --- a/src/mongo/db/catalog/collection_validation.cpp +++ b/src/mongo/db/catalog/collection_validation.cpp @@ -390,6 +390,12 @@ Status validate(OperationContext* opCtx, invariant(!opCtx->lockState()->isLocked()); invariant(!(background && (level == kValidateFull))); + if (background) { + // Force a checkpoint to ensure background validation has a checkpoint on which to run. + // TODO (SERVER-43134): to sort out how to do this properly. + opCtx->recoveryUnit()->waitUntilUnjournaledWritesDurable(opCtx); + } + AutoGetDb autoDB(opCtx, nss.db(), MODE_IX); boost::optional<Lock::CollectionLock> collLock; if (background) { @@ -510,6 +516,7 @@ Status validate(OperationContext* opCtx, if (MONGO_FAIL_POINT(pauseCollectionValidationWithLock)) { invariant(opCtx->lockState()->isCollectionLockedForMode(collection->ns(), MODE_IX)); _validationIsPausedForTest.store(true); + log() << "Failpoint 'pauseCollectionValidationWithLock' activated."; MONGO_FAIL_POINT_PAUSE_WHILE_SET(pauseCollectionValidationWithLock); _validationIsPausedForTest.store(false); } |