diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2020-04-24 12:40:52 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-04-24 18:59:03 +0000 |
commit | 560b266f41b1507ddb09cf6dfd61f26ca60b89b7 (patch) | |
tree | 4b930130c226a2231e2e834aaa9cccd4a2d6d8c0 /src | |
parent | 73070916d377b5196d7a75528606b905f28c990b (diff) | |
download | mongo-560b266f41b1507ddb09cf6dfd61f26ca60b89b7.tar.gz |
SERVER-47754 Allow background validation to run on storage engines that do not support checkpoints
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/commands/validate.cpp | 27 | ||||
-rw-r--r-- | src/mongo/db/storage/storage_init.cpp | 1 |
2 files changed, 13 insertions, 15 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. diff --git a/src/mongo/db/storage/storage_init.cpp b/src/mongo/db/storage/storage_init.cpp index 79da6ba81a8..b1e5b391890 100644 --- a/src/mongo/db/storage/storage_init.cpp +++ b/src/mongo/db/storage/storage_init.cpp @@ -68,7 +68,6 @@ public: << static_cast<long long>(engine->getDropPendingIdents().size()) << "supportsTwoPhaseIndexBuild" << engine->supportsTwoPhaseIndexBuild() << "supportsSnapshotReadConcern" << engine->supportsReadConcernSnapshot() - << "supportsCheckpointCursors" << engine->supportsCheckpoints() << "readOnly" << storageGlobalParams.readOnly << "persistent" << !engine->isEphemeral() << "backupCursorOpen" << backupCursorHooks->isBackupCursorOpen()); |