summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/validate.cpp
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2020-04-24 12:40:52 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-04-24 18:59:03 +0000
commit560b266f41b1507ddb09cf6dfd61f26ca60b89b7 (patch)
tree4b930130c226a2231e2e834aaa9cccd4a2d6d8c0 /src/mongo/db/commands/validate.cpp
parent73070916d377b5196d7a75528606b905f28c990b (diff)
downloadmongo-560b266f41b1507ddb09cf6dfd61f26ca60b89b7.tar.gz
SERVER-47754 Allow background validation to run on storage engines that do not support checkpoints
Diffstat (limited to 'src/mongo/db/commands/validate.cpp')
-rw-r--r--src/mongo/db/commands/validate.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/mongo/db/commands/validate.cpp b/src/mongo/db/commands/validate.cpp
index f9f6f2811c0..c60c32076cc 100644
--- a/src/mongo/db/commands/validate.cpp
+++ b/src/mongo/db/commands/validate.cpp
@@ -122,16 +122,15 @@ public:
}
const NamespaceString nss(CommandHelpers::parseNsCollectionRequired(dbname, cmdObj));
-
- const bool background = cmdObj["background"].trueValue();
-
- // 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::CommandNotSupported,
- str::stream() << "Running validate on collection " << nss
- << " with { background: true } is not supported on the "
- << storageGlobalParams.engine << " storage engine");
+ bool background = cmdObj["background"].trueValue();
+
+ // Background validation is not supported on the ephemeralForTest storage engine due to its
+ // lack of support for timestamps. Switch the mode to foreground validation instead.
+ if (background && storageGlobalParams.engine == "ephemeralForTest") {
+ LOGV2(4775400,
+ "ephemeralForTest does not support background validation, switching to "
+ "foreground validation.");
+ background = false;
}
const bool fullValidate = cmdObj["full"].trueValue();
@@ -143,10 +142,10 @@ public:
if (!serverGlobalParams.quiet.load()) {
LOGV2(20514,
- "CMD: validate {nss_ns}{background_background_true}{fullValidate_full_true}",
- "nss_ns"_attr = nss.ns(),
- "background_background_true"_attr = (background ? ", background:true" : ""),
- "fullValidate_full_true"_attr = (fullValidate ? ", full:true" : ""));
+ "CMD: validate",
+ "namespace"_attr = nss,
+ "background"_attr = background,
+ "full"_attr = fullValidate);
}
// Only one validation per collection can be in progress, the rest wait.