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 19:10:57 +0000 |
commit | bd8fdecf83f7de4fd73c0e0e3273865170bd80f9 (patch) | |
tree | a4b12a2c75a8cff8c2b10814892f0594abee0074 | |
parent | 111907e47c8b1b3fb2de31308ff3328cb13b8bd3 (diff) | |
download | mongo-bd8fdecf83f7de4fd73c0e0e3273865170bd80f9.tar.gz |
SERVER-47754 Allow background validation to run on storage engines that do not support checkpoints
(cherry picked from commit 560b266f41b1507ddb09cf6dfd61f26ca60b89b7)
-rw-r--r-- | buildscripts/resmokelib/testing/hooks/validate_background.py | 7 | ||||
-rw-r--r-- | jstests/hooks/run_validate_collections_background.js | 6 | ||||
-rw-r--r-- | src/mongo/db/commands/validate.cpp | 27 | ||||
-rw-r--r-- | src/mongo/db/storage/storage_init.cpp | 1 |
4 files changed, 13 insertions, 28 deletions
diff --git a/buildscripts/resmokelib/testing/hooks/validate_background.py b/buildscripts/resmokelib/testing/hooks/validate_background.py index 239b4f77d49..1b8f0691df3 100644 --- a/buildscripts/resmokelib/testing/hooks/validate_background.py +++ b/buildscripts/resmokelib/testing/hooks/validate_background.py @@ -27,13 +27,6 @@ class ValidateCollectionsInBackground(jsfile.JSHook): def before_suite(self, test_report): """Start the background thread.""" - server_status = self.fixture.mongo_client().admin.command("serverStatus") - if not server_status["storageEngine"].get("supportsCheckpointCursors", False): - self.logger.info( - "Not enabling the background collection validation thread because '%s' storage" - " engine does not support checkpoints.", server_status["storageEngine"]["name"]) - return - self._background_job = _BackgroundJob("ValidateCollectionsInBackground") self.logger.info("Starting the background collection validation thread.") self._background_job.start() diff --git a/jstests/hooks/run_validate_collections_background.js b/jstests/hooks/run_validate_collections_background.js index 778ee791002..89c8f2fcc21 100644 --- a/jstests/hooks/run_validate_collections_background.js +++ b/jstests/hooks/run_validate_collections_background.js @@ -67,12 +67,6 @@ const validateCollectionsBackgroundThread = function validateCollectionsBackgrou conn, "Failed to connect to host '" + host + "' for background collection validation"); - if (!conn.adminCommand("serverStatus").storageEngine.supportsCheckpointCursors) { - print("Skipping background validation against test node: " + host + - " because its storage engine does not support background validation (checkpoints)."); - return {ok: 1}; - } - // Filter out arbiters. if (conn.adminCommand({isMaster: 1}).arbiterOnly) { print("Skipping background validation against test node: " + host + diff --git a/src/mongo/db/commands/validate.cpp b/src/mongo/db/commands/validate.cpp index 81d9c35de70..11c0b2515ad 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()); |