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>2022-02-04 21:08:03 +0000
commitf304f262128f49d937034cf4eb4550a0a4fa596a (patch)
tree984b31ddfa5230426ac35557411594662756da6b
parent32d791e2c466ad480b47b050dc0016018775473b (diff)
downloadmongo-f304f262128f49d937034cf4eb4550a0a4fa596a.tar.gz
SERVER-55483 Add a new startup parameter that skips verifying the table
logging settings (cherry picked from commit 9cbf52051d506a029546c1e7e28a5f77afd8bd46) (cherry picked from commit 4fe865b3085ff7a8ccea186076ec0575a3bec197)
-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 050e148cf11..da162a86ace 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 58e85385615..85121941458 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/logv2/log.h"
@@ -710,6 +711,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;