diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2021-09-14 14:53:23 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-09 02:36:52 +0000 |
commit | dd680775aa8b27f442dd7b72a7b18ad569054646 (patch) | |
tree | e659d52f520cd2ff07de8589b373ad1bbc1c0fd3 | |
parent | 0491f281895741b178e668d98937c2f92f797d25 (diff) | |
download | mongo-dd680775aa8b27f442dd7b72a7b18ad569054646.tar.gz |
SERVER-55483 Add a new startup parameter that skips verifying the table
logging settings
(cherry picked from commit 4fe865b3085ff7a8ccea186076ec0575a3bec197)
-rw-r--r-- | jstests/disk/wt_table_checks.js | 36 | ||||
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_parameters.idl | 8 | ||||
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp | 20 |
3 files changed, 64 insertions, 0 deletions
diff --git a/jstests/disk/wt_table_checks.js b/jstests/disk/wt_table_checks.js index a97344a19df..17c511a2828 100644 --- a/jstests/disk/wt_table_checks.js +++ b/jstests/disk/wt_table_checks.js @@ -56,6 +56,11 @@ for (f in files) { writeFile(dbpath + "/_wt_table_checks", ""); +// Cannot skip table logging checks on startup when there are previously incomplete table checks. +conn = startMongodOnExistingPath(dbpath, + {setParameter: "wiredTigerSkipTableLoggingChecksOnStartup=true"}); +assert.eq(conn, null); + conn = startMongodOnExistingPath(dbpath, {}); checkLog.contains( conn, @@ -102,4 +107,35 @@ checkLog.contains( conn, "Modifying the table logging settings for all existing WiredTiger tables. Logging enabled? 0"); MongoRunner.stopMongod(conn); + +/** + * Test 6. Restart as a standalone and skip table logging checks on startup. Verify that restarting + * as a replica set again does not require any table logging modifications. + */ +jsTest.log("Test 6."); + +conn = startMongodOnExistingPath(dbpath, { + setParameter: { + wiredTigerSkipTableLoggingChecksOnStartup: true, + logComponentVerbosity: tojson({verbosity: 1}) + } +}); + +// Skipping table logging checks for all existing tables. +checkLog.contains(conn, + "Skipping table logging checks for all existing WiredTiger" + + " tables on startup. wiredTigerSkipTableLoggingChecksOnStartup=1"); + +// Log level 1 prints each individual table it skips table logging checks for. +checkLog.contains(conn, "Skipping table logging check"); + +MongoRunner.stopMongod(conn); + +conn = startMongodOnExistingPath(dbpath, {replSet: "mySet"}); + +// No table logging settings modifications are required. +checkLog.contains(conn, + "No table logging settings modifications" + + " are required for existing WiredTiger tables"); +MongoRunner.stopMongod(conn); }()); diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_parameters.idl b/src/mongo/db/storage/wiredtiger/wiredtiger_parameters.idl index c7706b08b7a..fe4d2d682be 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_parameters.idl +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_parameters.idl @@ -145,3 +145,11 @@ server_parameters: default: 10 validator: gte: 1 + + wiredTigerSkipTableLoggingChecksOnStartup: + description: >- + Skips table logging setting checks and modifications on startup. + set_at: startup + cpp_vartype: 'bool' + cpp_varname: gWiredTigerSkipTableLoggingChecksOnStartup + default: false diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp index db82f29378c..fcebf78d238 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp @@ -44,6 +44,7 @@ #include "mongo/db/snapshot_window_options.h" #include "mongo/db/storage/storage_file_util.h" #include "mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h" +#include "mongo/db/storage/wiredtiger/wiredtiger_parameters_gen.h" #include "mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h" #include "mongo/db/storage/wiredtiger/wiredtiger_session_cache.h" #include "mongo/util/assert_util.h" @@ -669,6 +670,25 @@ Status WiredTigerUtil::setTableLogging(WT_SESSION* session, const std::string& u _tableLoggingInfo.hasPreviouslyIncompleteTableChecks = true; } + if (gWiredTigerSkipTableLoggingChecksOnStartup) { + if (_tableLoggingInfo.hasPreviouslyIncompleteTableChecks) { + log() << "Cannot use the 'wiredTigerSkipTableLoggingChecksOnStartup' startup parameter " + "when there are previously incomplete table checks"; + fassertFailedNoTrace(5548300); + } + + // Only log this warning once. + if (_tableLoggingInfo.isFirstTable) { + _tableLoggingInfo.isFirstTable = false; + log() << "Skipping table logging checks for all existing WiredTiger tables on startup. " + "wiredTigerSkipTableLoggingChecksOnStartup=" + << gWiredTigerSkipTableLoggingChecksOnStartup; + } + + LOG(1) << "Skipping table logging check for " << uri; + return Status::OK(); + } + if (storageGlobalParams.repair || _tableLoggingInfo.hasPreviouslyIncompleteTableChecks) { if (_tableLoggingInfo.isFirstTable) { _tableLoggingInfo.isFirstTable = false; |