summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2021-09-14 14:53:23 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-12-13 20:19:05 +0000
commit4fe865b3085ff7a8ccea186076ec0575a3bec197 (patch)
tree49c82115ebb62a96bf0e7a3426f135e2ef51ee4d
parent4b2608fc881f8443c0945a060129b92282674f3d (diff)
downloadmongo-4fe865b3085ff7a8ccea186076ec0575a3bec197.tar.gz
SERVER-55483 Add a new startup parameter that skips verifying the table
logging settings (cherry picked from commit 9cbf52051d506a029546c1e7e28a5f77afd8bd46)
-rw-r--r--jstests/disk/wt_table_checks.js32
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_parameters.idl8
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp24
3 files changed, 64 insertions, 0 deletions
diff --git a/jstests/disk/wt_table_checks.js b/jstests/disk/wt_table_checks.js
index 9c2b4407323..6d0cf003aab 100644
--- a/jstests/disk/wt_table_checks.js
+++ b/jstests/disk/wt_table_checks.js
@@ -52,6 +52,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.containsJson(
conn, 4366405, {loggingEnabled: true, repair: false, hasPreviouslyIncompleteTableChecks: true});
@@ -94,4 +99,31 @@ jsTest.log("Test 5.");
conn = startMongodOnExistingPath(dbpath, {replSet: "mySet"});
checkLog.containsJson(conn, 4366406, {loggingEnabled: false});
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.containsJson(conn, 5548301, {wiredTigerSkipTableLoggingChecksOnStartup: true});
+
+// Log level 1 prints each individual table it skips table logging checks for.
+checkLog.containsJson(conn, 5548302);
+
+MongoRunner.stopMongod(conn);
+
+conn = startMongodOnExistingPath(dbpath, {replSet: "mySet"});
+
+// No table logging settings modifications are required.
+checkLog.containsJson(conn, 4366408);
+MongoRunner.stopMongod(conn);
}());
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_parameters.idl b/src/mongo/db/storage/wiredtiger/wiredtiger_parameters.idl
index 6b110639515..7f0a5f85086 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_parameters.idl
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_parameters.idl
@@ -156,3 +156,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 07fabadd634..9fcdd78858f 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_gen.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/logv2/log.h"
@@ -727,6 +728,29 @@ Status WiredTigerUtil::setTableLogging(WT_SESSION* session, const std::string& u
_tableLoggingInfo.hasPreviouslyIncompleteTableChecks = true;
}
+ if (gWiredTigerSkipTableLoggingChecksOnStartup) {
+ if (_tableLoggingInfo.hasPreviouslyIncompleteTableChecks) {
+ LOGV2_FATAL_NOTRACE(
+ 5548300,
+ "Cannot use the 'wiredTigerSkipTableLoggingChecksOnStartup' startup parameter when "
+ "there are previously incomplete table checks");
+ }
+
+ // Only log this warning once.
+ if (_tableLoggingInfo.isFirstTable) {
+ _tableLoggingInfo.isFirstTable = false;
+ LOGV2_WARNING_OPTIONS(
+ 5548301,
+ {logv2::LogTag::kStartupWarnings},
+ "Skipping table logging checks for all existing WiredTiger tables on startup",
+ "wiredTigerSkipTableLoggingChecksOnStartup"_attr =
+ gWiredTigerSkipTableLoggingChecksOnStartup);
+ }
+
+ LOGV2_DEBUG(5548302, 1, "Skipping table logging check", "uri"_attr = uri);
+ return Status::OK();
+ }
+
if (storageGlobalParams.repair || _tableLoggingInfo.hasPreviouslyIncompleteTableChecks) {
if (_tableLoggingInfo.isFirstTable) {
_tableLoggingInfo.isFirstTable = false;