summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/validate.cpp
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2019-08-15 14:34:29 -0400
committerGregory Wlodarek <gregory.wlodarek@mongodb.com>2019-08-16 12:16:40 -0400
commit57e2f5bb65413907950899c8e0ab6e4ec82ff1d1 (patch)
tree1f115c0f0bae4d5b66ec37087fa414e1f081f532 /src/mongo/db/commands/validate.cpp
parentb135a73117c9fdfbce369cacf07bfc245f99330e (diff)
downloadmongo-57e2f5bb65413907950899c8e0ab6e4ec82ff1d1.tar.gz
SERVER-42768 uassert if the storage engine does not support checkpoints when running validate with { background: true }
Diffstat (limited to 'src/mongo/db/commands/validate.cpp')
-rw-r--r--src/mongo/db/commands/validate.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mongo/db/commands/validate.cpp b/src/mongo/db/commands/validate.cpp
index f0eafc0d873..8a06f7a3df0 100644
--- a/src/mongo/db/commands/validate.cpp
+++ b/src/mongo/db/commands/validate.cpp
@@ -129,6 +129,18 @@ public:
level = kValidateFull;
}
+ // TODO (SERVER-30357): Add support for background validation.
+ const bool background = false;
+
+ // Background validation requires the storage engine to support checkpoints because it
+ // performs the validation on a checkpoint using checkpoint cursors.
+ if (background && !opCtx->getServiceContext()->getStorageEngine()->supportsCheckpoints()) {
+ uasserted(ErrorCodes::CommandFailed,
+ str::stream() << "Running validate on collection " << nss
+ << " with { background: true } is not supported on the "
+ << storageGlobalParams.engine << " storage engine");
+ }
+
if (!serverGlobalParams.quiet.load()) {
LOG(0) << "CMD: validate " << nss.ns();
}
@@ -172,9 +184,6 @@ public:
_validationNotifier.notify_all();
});
- // TODO (SERVER-30357): Add support for background validation.
- const bool background = false;
-
ValidateResults results;
Status status =
CollectionValidation::validate(opCtx, collection, level, background, &results, &result);