summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheahuychou Mao <cheahuychou.mao@mongodb.com>2020-03-24 17:39:15 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-27 22:39:04 +0000
commit2abab48428af3ba6e1dd9a911f2aa34c77ecb891 (patch)
treed3ed14843579a198c8871ce27b6f5e9637c8c271
parent86daed7acfc1a2adf97bf7d7b2ae009d7b52df24 (diff)
downloadmongo-2abab48428af3ba6e1dd9a911f2aa34c77ecb891.tar.gz
SERVER-47076 Clean up log lines in mongo/util
-rw-r--r--jstests/disk/libs/wt_file_helper.js4
-rw-r--r--jstests/disk/wt_corrupt_file_errors.js8
-rw-r--r--jstests/disk/wt_missing_file_errors.js8
-rw-r--r--jstests/replsets/invalid_index_spec.js2
-rw-r--r--jstests/replsets/rollback_after_enabling_majority_reads.js2
-rw-r--r--jstests/sharding/shard_identity_rollback.js2
-rw-r--r--src/mongo/base/status_test.cpp2
-rw-r--r--src/mongo/db/op_observer_impl_test.cpp2
-rw-r--r--src/mongo/db/repl/replication_recovery_test.cpp28
-rw-r--r--src/mongo/db/repl/rs_rollback_test.cpp2
-rw-r--r--src/mongo/db/storage/kv/kv_engine_test_harness.cpp2
-rw-r--r--src/mongo/util/alarm_test.cpp7
-rw-r--r--src/mongo/util/assert_util.cpp46
-rw-r--r--src/mongo/util/background.cpp32
-rw-r--r--src/mongo/util/concurrency/thread_name.cpp10
-rw-r--r--src/mongo/util/concurrency/thread_pool.cpp126
-rw-r--r--src/mongo/util/concurrency/thread_pool_test.cpp8
-rw-r--r--src/mongo/util/concurrency/thread_pool_test_common.cpp4
-rw-r--r--src/mongo/util/concurrency/with_lock_test.cpp5
-rw-r--r--src/mongo/util/diagnostic_info.cpp10
-rw-r--r--src/mongo/util/exception_filter_win32.cpp31
-rw-r--r--src/mongo/util/exit.cpp13
-rw-r--r--src/mongo/util/fail_point.cpp14
-rw-r--r--src/mongo/util/fail_point_test.cpp2
-rw-r--r--src/mongo/util/file.cpp148
-rw-r--r--src/mongo/util/heap_profiler.cpp26
-rw-r--r--src/mongo/util/secure_zero_memory_test.cpp2
27 files changed, 315 insertions, 231 deletions
diff --git a/jstests/disk/libs/wt_file_helper.js b/jstests/disk/libs/wt_file_helper.js
index a055fa5fa33..fc4f1e9aa0a 100644
--- a/jstests/disk/libs/wt_file_helper.js
+++ b/jstests/disk/libs/wt_file_helper.js
@@ -83,7 +83,7 @@ let assertErrorOnStartupWhenStartingAsReplSet = function(dbpath, port, rsName) {
let node = MongoRunner.runMongod(
{dbpath: dbpath, port: port, replSet: rsName, noCleanData: true, waitForConnect: false});
assert.soon(function() {
- return rawMongoProgramOutput().search(/Fatal Assertion.*50923/) >= 0;
+ return rawMongoProgramOutput().search(/Fatal assertion.*50923/) >= 0;
});
MongoRunner.stopMongod(node, null, {allowedExitCode: MongoRunner.EXIT_ABRUPT});
};
@@ -99,7 +99,7 @@ let assertErrorOnStartupAfterIncompleteRepair = function(dbpath, port) {
let node = MongoRunner.runMongod(
{dbpath: dbpath, port: port, noCleanData: true, waitForConnect: false});
assert.soon(function() {
- return rawMongoProgramOutput().search(/Fatal Assertion.*50922/) >= 0;
+ return rawMongoProgramOutput().search(/Fatal assertion.*50922/) >= 0;
});
MongoRunner.stopMongod(node, null, {allowedExitCode: MongoRunner.EXIT_ABRUPT});
};
diff --git a/jstests/disk/wt_corrupt_file_errors.js b/jstests/disk/wt_corrupt_file_errors.js
index ec1f76b3a52..bd799a992ea 100644
--- a/jstests/disk/wt_corrupt_file_errors.js
+++ b/jstests/disk/wt_corrupt_file_errors.js
@@ -32,7 +32,7 @@ assertErrorOnRequestWhenFilesAreCorruptOrMissing(
testColl.insert({a: 1});
});
},
- new RegExp("Fatal Assertion.*50882"));
+ new RegExp("Fatal assertion.*50882"));
/**
* Test 2. Corrupt the _mdb_catalog.
@@ -43,7 +43,7 @@ assertErrorOnStartupWhenFilesAreCorruptOrMissing(dbpath, baseName, collName, (mo
const mdbCatalogFile = dbpath + "_mdb_catalog.wt";
jsTestLog("corrupting catalog file: " + mdbCatalogFile);
corruptFile(mdbCatalogFile);
-}, new RegExp("Fatal Assertion.*50882"));
+}, new RegExp("Fatal assertion.*50882"));
/**
* Test 3. Corrupt the WiredTiger.wt.
@@ -54,7 +54,7 @@ assertErrorOnStartupWhenFilesAreCorruptOrMissing(dbpath, baseName, collName, (mo
const WiredTigerWTFile = dbpath + "WiredTiger.wt";
jsTestLog("corrupting WiredTiger.wt");
corruptFile(WiredTigerWTFile);
-}, new RegExp("Fatal Assertion.*50944"));
+}, new RegExp("Fatal assertion.*50944"));
/**
* Test 4. Corrupt an index file.
@@ -80,5 +80,5 @@ assertErrorOnRequestWhenFilesAreCorruptOrMissing(
testColl.insert({a: 1});
});
},
- new RegExp("Fatal Assertion.*50882"));
+ new RegExp("Fatal assertion.*50882"));
})();
diff --git a/jstests/disk/wt_missing_file_errors.js b/jstests/disk/wt_missing_file_errors.js
index 9abb24fafdc..85310fa82e9 100644
--- a/jstests/disk/wt_missing_file_errors.js
+++ b/jstests/disk/wt_missing_file_errors.js
@@ -32,7 +32,7 @@ assertErrorOnRequestWhenFilesAreCorruptOrMissing(
testColl.insert({a: 1});
});
},
- new RegExp("Fatal Assertion.*50883"));
+ new RegExp("Fatal assertion.*50883"));
/**
* Test 2. Delete the _mdb_catalog.
@@ -43,7 +43,7 @@ assertErrorOnStartupWhenFilesAreCorruptOrMissing(dbpath, baseName, collName, (mo
let mdbCatalogFile = dbpath + "_mdb_catalog.wt";
jsTestLog("deleting catalog file: " + mdbCatalogFile);
removeFile(mdbCatalogFile);
-}, new RegExp("Fatal Assertion.*50883"));
+}, new RegExp("Fatal assertion.*50883"));
/**
* Test 3. Delete the WiredTiger.wt.
@@ -54,7 +54,7 @@ assertErrorOnStartupWhenFilesAreCorruptOrMissing(dbpath, baseName, collName, (mo
let WiredTigerWTFile = dbpath + "WiredTiger.wt";
jsTestLog("deleting WiredTiger.wt");
removeFile(WiredTigerWTFile);
-}, new RegExp("Fatal Assertion.*50944"));
+}, new RegExp("Fatal assertion.*50944"));
/**
* Test 4. Delete an index file.
@@ -80,5 +80,5 @@ assertErrorOnRequestWhenFilesAreCorruptOrMissing(
testColl.insert({a: 1});
});
},
- new RegExp("Fatal Assertion.*50883"));
+ new RegExp("Fatal assertion.*50883"));
})();
diff --git a/jstests/replsets/invalid_index_spec.js b/jstests/replsets/invalid_index_spec.js
index 35e1491bcde..0d2a706066c 100644
--- a/jstests/replsets/invalid_index_spec.js
+++ b/jstests/replsets/invalid_index_spec.js
@@ -49,7 +49,7 @@ replTest.stop(secondary, undefined, {allowedExitCode: exitCode});
// During the transition from the old code path in IndexBuilder to IndexBuildsCoordinator, we
// will accept the fatal assertion code from either component.
-const msgIndexBuilder = "Fatal Assertion 50769";
+const msgIndexBuilder = "Fatal assertion 50769";
const msgIndexBuildsCoordinator = "Fatal assertion 34437";
const msgIndexErrorType = "InvalidIndexSpecificationOption";
const msgIndexError = "The field 'invalidOption2'";
diff --git a/jstests/replsets/rollback_after_enabling_majority_reads.js b/jstests/replsets/rollback_after_enabling_majority_reads.js
index a4ba0569afd..d45bfc4524f 100644
--- a/jstests/replsets/rollback_after_enabling_majority_reads.js
+++ b/jstests/replsets/rollback_after_enabling_majority_reads.js
@@ -51,7 +51,7 @@ jsTest.log("Attempt to roll back. This will fassert.");
rollbackTest.transitionToSyncSourceOperationsBeforeRollback();
rollbackTest.transitionToSyncSourceOperationsDuringRollback();
assert.soon(() => {
- return rawMongoProgramOutput().search(/Fatal Assertion.+51121/) != -1;
+ return rawMongoProgramOutput().search(/Fatal assertion.+51121/) != -1;
});
jsTest.log(
diff --git a/jstests/sharding/shard_identity_rollback.js b/jstests/sharding/shard_identity_rollback.js
index 912645b875d..87a48c3b758 100644
--- a/jstests/sharding/shard_identity_rollback.js
+++ b/jstests/sharding/shard_identity_rollback.js
@@ -85,7 +85,7 @@ jsTest.log("Waiting for original primary to rollback and shut down");
// Wait until the node shuts itself down during the rollback. We will hit the first assertion if
// we rollback using 'recoverToStableTimestamp' and the second if using 'rollbackViaRefetch'.
assert.soon(() => {
- return (rawMongoProgramOutput().search(/Fatal Assertion.*(40498|50712)/) !== -1);
+ return (rawMongoProgramOutput().search(/Fatal assertion.*(40498|50712)/) !== -1);
});
// Restart the original primary again. This time, the shardIdentity document should already be
diff --git a/src/mongo/base/status_test.cpp b/src/mongo/base/status_test.cpp
index adb710f06d6..cdf1e8ab80c 100644
--- a/src/mongo/base/status_test.cpp
+++ b/src/mongo/base/status_test.cpp
@@ -285,7 +285,7 @@ DEATH_TEST_REGEX(ErrorExtraInfo, InvariantAllRegistered, "Invariant failure.*par
}
#ifdef MONGO_CONFIG_DEBUG_BUILD
-DEATH_TEST_REGEX(ErrorExtraInfo, DassertShouldHaveExtraInfo, "Fatal Assertion.*40680") {
+DEATH_TEST_REGEX(ErrorExtraInfo, DassertShouldHaveExtraInfo, "Fatal assertion.*40680") {
Status(ErrorCodes::ForTestingErrorExtraInfo, "");
}
#else
diff --git a/src/mongo/db/op_observer_impl_test.cpp b/src/mongo/db/op_observer_impl_test.cpp
index 4408c7494c4..0dd1bc6d4d5 100644
--- a/src/mongo/db/op_observer_impl_test.cpp
+++ b/src/mongo/db/op_observer_impl_test.cpp
@@ -559,7 +559,7 @@ DEATH_TEST_F(OpObserverTest, EachOnDeleteRequiresAboutToDelete, "invariant") {
DEATH_TEST_REGEX_F(OpObserverTest,
NodeCrashesIfShardIdentityDocumentRolledBack,
- "Fatal Assertion.*50712") {
+ "Fatal assertion.*50712") {
OpObserverImpl opObserver;
auto opCtx = cc().makeOperationContext();
diff --git a/src/mongo/db/repl/replication_recovery_test.cpp b/src/mongo/db/repl/replication_recovery_test.cpp
index a549db365af..4adeddcb79d 100644
--- a/src/mongo/db/repl/replication_recovery_test.cpp
+++ b/src/mongo/db/repl/replication_recovery_test.cpp
@@ -455,7 +455,7 @@ DEATH_TEST_F(ReplicationRecoveryTest,
recovery.recoverFromOplog(opCtx, Timestamp(1, 1));
}
-DEATH_TEST_REGEX_F(ReplicationRecoveryTest, TruncateEntireOplogFasserts, "Fatal Assertion.*40296") {
+DEATH_TEST_REGEX_F(ReplicationRecoveryTest, TruncateEntireOplogFasserts, "Fatal assertion.*40296") {
ReplicationRecoveryImpl recovery(getStorageInterface(), getConsistencyMarkers());
auto opCtx = getOperationContext();
@@ -781,7 +781,7 @@ TEST_F(ReplicationRecoveryTest,
DEATH_TEST_REGEX_F(ReplicationRecoveryTest,
AppliedThroughBehindOplogFasserts,
- "Fatal Assertion.*40292") {
+ "Fatal assertion.*40292") {
ReplicationRecoveryImpl recovery(getStorageInterface(), getConsistencyMarkers());
auto opCtx = getOperationContext();
@@ -793,7 +793,7 @@ DEATH_TEST_REGEX_F(ReplicationRecoveryTest,
DEATH_TEST_REGEX_F(ReplicationRecoveryTest,
AppliedThroughAheadOfTopOfOplogCausesFassert,
- "Fatal Assertion.*40313") {
+ "Fatal assertion.*40313") {
ReplicationRecoveryImpl recovery(getStorageInterface(), getConsistencyMarkers());
auto opCtx = getOperationContext();
@@ -805,7 +805,7 @@ DEATH_TEST_REGEX_F(ReplicationRecoveryTest,
DEATH_TEST_REGEX_F(ReplicationRecoveryTest,
AppliedThroughNotInOplogCausesFassert,
- "Fatal Assertion.*40292") {
+ "Fatal assertion.*40292") {
ReplicationRecoveryImpl recovery(getStorageInterface(), getConsistencyMarkers());
auto opCtx = getOperationContext();
@@ -1083,7 +1083,7 @@ TEST_F(ReplicationRecoveryTest, AbortTransactionOplogEntryCorrectlyUpdatesConfig
DEATH_TEST_REGEX_F(ReplicationRecoveryTest,
RecoveryFailsWithPrepareAndEnableReadConcernMajorityFalse,
- "Fatal Assertion.*51146") {
+ "Fatal assertion.*51146") {
ReplicationRecoveryImpl recovery(getStorageInterface(), getConsistencyMarkers());
auto opCtx = getOperationContext();
@@ -1471,7 +1471,7 @@ TEST_F(ReplicationRecoveryTest,
DEATH_TEST_REGEX_F(ReplicationRecoveryTest,
RecoverFromOplogUpToWithoutStableCheckpoint,
- "Fatal Assertion.*31399") {
+ "Fatal assertion.*31399") {
ReplicationRecoveryImpl recovery(getStorageInterface(), getConsistencyMarkers());
auto opCtx = getOperationContext();
@@ -1482,7 +1482,7 @@ DEATH_TEST_REGEX_F(ReplicationRecoveryTest,
DEATH_TEST_REGEX_F(ReplicationRecoveryTest,
RecoverFromOplogAsStandaloneFailsWithoutStableCheckpoint,
- "Fatal Assertion.*31229") {
+ "Fatal assertion.*31229") {
ReplicationRecoveryImpl recovery(getStorageInterface(), getConsistencyMarkers());
auto opCtx = getOperationContext();
@@ -1493,7 +1493,7 @@ DEATH_TEST_REGEX_F(ReplicationRecoveryTest,
DEATH_TEST_REGEX_F(ReplicationRecoveryTest,
RecoverFromOplogAsStandaloneFailsWithNullStableCheckpoint,
- "Fatal Assertion.*50806") {
+ "Fatal assertion.*50806") {
ReplicationRecoveryImpl recovery(getStorageInterface(), getConsistencyMarkers());
auto opCtx = getOperationContext();
@@ -1505,7 +1505,7 @@ DEATH_TEST_REGEX_F(ReplicationRecoveryTest,
DEATH_TEST_REGEX_F(ReplicationRecoveryTest,
RecoverFromOplogUpToFailsWithNullStableCheckpoint,
- "Fatal Assertion.*50806") {
+ "Fatal assertion.*50806") {
ReplicationRecoveryImpl recovery(getStorageInterface(), getConsistencyMarkers());
auto opCtx = getOperationContext();
@@ -1562,7 +1562,7 @@ TEST_F(ReplicationRecoveryTest,
DEATH_TEST_REGEX_F(
ReplicationRecoveryTest,
RecoverFromOplogAsStandaloneWithTakeUnstableCheckpointOnShutdownFailsWithInitialSyncFlag,
- "Fatal Assertion.*31362") {
+ "Fatal assertion.*31362") {
gTakeUnstableCheckpointOnShutdown = true;
ReplicationRecoveryImpl recovery(getStorageInterface(), getConsistencyMarkers());
@@ -1577,7 +1577,7 @@ DEATH_TEST_REGEX_F(
DEATH_TEST_REGEX_F(
ReplicationRecoveryTest,
RecoverFromOplogAsStandaloneWithTakeUnstableCheckpointOnShutdownFailsWithOplogTruncateAfterPoint,
- "Fatal Assertion.*31363") {
+ "Fatal assertion.*31363") {
gTakeUnstableCheckpointOnShutdown = true;
ReplicationRecoveryImpl recovery(getStorageInterface(), getConsistencyMarkers());
@@ -1592,7 +1592,7 @@ DEATH_TEST_REGEX_F(
DEATH_TEST_REGEX_F(
ReplicationRecoveryTest,
RecoverFromOplogAsStandaloneWithTakeUnstableCheckpointOnShutdownFailsWithEmptyOplog,
- "Fatal Assertion.*31364") {
+ "Fatal assertion.*31364") {
gTakeUnstableCheckpointOnShutdown = true;
ReplicationRecoveryImpl recovery(getStorageInterface(), getConsistencyMarkers());
@@ -1606,7 +1606,7 @@ DEATH_TEST_REGEX_F(
DEATH_TEST_REGEX_F(
ReplicationRecoveryTest,
RecoverFromOplogAsStandaloneWithTakeUnstableCheckpointOnShutdownFailsWithMismatchedAppliedThrough,
- "Fatal Assertion.*31365") {
+ "Fatal assertion.*31365") {
gTakeUnstableCheckpointOnShutdown = true;
ReplicationRecoveryImpl recovery(getStorageInterface(), getConsistencyMarkers());
@@ -1621,7 +1621,7 @@ DEATH_TEST_REGEX_F(
DEATH_TEST_REGEX_F(
ReplicationRecoveryTest,
RecoverFromOplogAsStandaloneWithTakeUnstableCheckpointOnShutdownFailsWithHighMinValid,
- "Fatal Assertion.*31366") {
+ "Fatal assertion.*31366") {
gTakeUnstableCheckpointOnShutdown = true;
ReplicationRecoveryImpl recovery(getStorageInterface(), getConsistencyMarkers());
diff --git a/src/mongo/db/repl/rs_rollback_test.cpp b/src/mongo/db/repl/rs_rollback_test.cpp
index d66c5c7c505..3571a1377d5 100644
--- a/src/mongo/db/repl/rs_rollback_test.cpp
+++ b/src/mongo/db/repl/rs_rollback_test.cpp
@@ -2176,7 +2176,7 @@ TEST(RSRollbackTest, LocalEntryWithoutOIsFatal) {
RSFatalException);
}
-DEATH_TEST_F(RSRollbackTest, LocalUpdateEntryWithoutO2IsFatal, "Fatal Assertion") {
+DEATH_TEST_F(RSRollbackTest, LocalUpdateEntryWithoutO2IsFatal, "Fatal assertion") {
const auto invalidOplogEntry = BSON("op"
<< "u"
<< "ui" << UUID::gen() << "ts" << Timestamp(1, 1) << "t"
diff --git a/src/mongo/db/storage/kv/kv_engine_test_harness.cpp b/src/mongo/db/storage/kv/kv_engine_test_harness.cpp
index 1d59850375d..9ffb9a6da0d 100644
--- a/src/mongo/db/storage/kv/kv_engine_test_harness.cpp
+++ b/src/mongo/db/storage/kv/kv_engine_test_harness.cpp
@@ -638,7 +638,7 @@ TEST_F(DurableCatalogImplTest, BackupImplemented) {
DEATH_TEST_REGEX_F(DurableCatalogImplTest,
TerminateOnNonNumericIndexVersion,
- "Fatal Assertion.*50942") {
+ "Fatal assertion.*50942") {
setGlobalServiceContext(ServiceContext::make());
std::unique_ptr<KVHarnessHelper> helper(KVHarnessHelper::create());
KVEngine* engine = helper->getEngine();
diff --git a/src/mongo/util/alarm_test.cpp b/src/mongo/util/alarm_test.cpp
index b1eba261cee..9da70d6ea3b 100644
--- a/src/mongo/util/alarm_test.cpp
+++ b/src/mongo/util/alarm_test.cpp
@@ -49,21 +49,22 @@ TEST(AlarmScheduler, BasicSingleThread) {
auto alarm = scheduler->alarmAt(testStart + Milliseconds(10));
bool firstTimerExpired = false;
std::move(alarm.future).getAsync([&](Status status) {
- LOGV2(23071, "Timer expired: {status}", "status"_attr = status);
+ LOGV2(23071, "First timer expired: {error}", "First timer expired", "error"_attr = status);
firstTimerExpired = true;
});
alarm = scheduler->alarmAt(testStart + Milliseconds(500));
bool secondTimerExpired = false;
std::move(alarm.future).getAsync([&](Status status) {
- LOGV2(23072, "Second timer expired: {status}", "status"_attr = status);
+ LOGV2(
+ 23072, "Second timer expired: {error}", "Second timer expired", "error"_attr = status);
secondTimerExpired = true;
});
alarm = scheduler->alarmAt(testStart + Milliseconds(515));
bool thirdTimerExpired = false;
std::move(alarm.future).getAsync([&](Status status) {
- LOGV2(23073, "third timer expired: {status}", "status"_attr = status);
+ LOGV2(23073, "Third timer expired: {error}", "Third timer expired", "error"_attr = status);
thirdTimerExpired = true;
});
auto missingEvent = alarm.handle;
diff --git a/src/mongo/util/assert_util.cpp b/src/mongo/util/assert_util.cpp
index c9dab10006a..c4d40969d6f 100644
--- a/src/mongo/util/assert_util.cpp
+++ b/src/mongo/util/assert_util.cpp
@@ -77,7 +77,7 @@ AtomicWord<bool> DBException::traceExceptions(false);
void DBException::traceIfNeeded(const DBException& e) {
if (traceExceptions.load()) {
- LOGV2_WARNING(23075, "DBException thrown{causedBy_e}", "causedBy_e"_attr = causedBy(e));
+ LOGV2_WARNING(23075, "DBException thrown {error}", "DBException thrown", "error"_attr = e);
printStackTrace();
}
}
@@ -86,6 +86,7 @@ MONGO_COMPILER_NOINLINE void verifyFailed(const char* expr, const char* file, un
assertionCount.condrollover(assertionCount.regular.addAndFetch(1));
LOGV2_ERROR(23076,
"Assertion failure {expr} {file} {line}",
+ "Assertion failure",
"expr"_attr = expr,
"file"_attr = file,
"line"_attr = line);
@@ -108,6 +109,7 @@ MONGO_COMPILER_NOINLINE void invariantFailed(const char* expr,
unsigned line) noexcept {
LOGV2_FATAL_CONTINUE(23079,
"Invariant failure {expr} {file} {line}",
+ "Invariant failure",
"expr"_attr = expr,
"file"_attr = file,
"line"_attr = line);
@@ -122,6 +124,7 @@ MONGO_COMPILER_NOINLINE void invariantFailedWithMsg(const char* expr,
unsigned line) noexcept {
LOGV2_FATAL_CONTINUE(23081,
"Invariant failure {expr} {msg} {file} {line}",
+ "Invariant failure",
"expr"_attr = expr,
"msg"_attr = msg,
"file"_attr = file,
@@ -136,9 +139,10 @@ MONGO_COMPILER_NOINLINE void invariantOKFailed(const char* expr,
const char* file,
unsigned line) noexcept {
LOGV2_FATAL_CONTINUE(23083,
- "Invariant failure: {expr} resulted in status {status} at {file} {line}",
+ "Invariant failure {expr} resulted in status {error} at {file} {line}",
+ "Invariant failure",
"expr"_attr = expr,
- "status"_attr = redact(status),
+ "error"_attr = redact(status),
"file"_attr = file,
"line"_attr = line);
breakpoint();
@@ -153,10 +157,11 @@ MONGO_COMPILER_NOINLINE void invariantOKFailedWithMsg(const char* expr,
unsigned line) noexcept {
LOGV2_FATAL_CONTINUE(
23085,
- "Invariant failure: {expr} {msg} resulted in status {status} at {file} {line}",
+ "Invariant failure {expr} {msg} resulted in status {error} at {file} {line}",
+ "Invariant failure",
"expr"_attr = expr,
"msg"_attr = msg,
- "status"_attr = redact(status),
+ "error"_attr = redact(status),
"file"_attr = file,
"line"_attr = line);
breakpoint();
@@ -168,8 +173,9 @@ MONGO_COMPILER_NOINLINE void invariantStatusOKFailed(const Status& status,
const char* file,
unsigned line) noexcept {
LOGV2_FATAL_CONTINUE(23087,
- "Invariant failure {status} at {file} {line}",
- "status"_attr = redact(status),
+ "Invariant failure {error} at {file} {line}",
+ "Invariant failure",
+ "error"_attr = redact(status),
"file"_attr = file,
"line"_attr = line);
breakpoint();
@@ -181,7 +187,8 @@ MONGO_COMPILER_NOINLINE void fassertFailedWithLocation(int msgid,
const char* file,
unsigned line) noexcept {
LOGV2_FATAL_CONTINUE(23089,
- "Fatal Assertion {msgid} at {file} {line}",
+ "Fatal assertion {msgid} at {file} {line}",
+ "Fatal assertion",
"msgid"_attr = msgid,
"file"_attr = file,
"line"_attr = line);
@@ -194,7 +201,8 @@ MONGO_COMPILER_NOINLINE void fassertFailedNoTraceWithLocation(int msgid,
const char* file,
unsigned line) noexcept {
LOGV2_FATAL_CONTINUE(23091,
- "Fatal Assertion {msgid} at {file} {line}",
+ "Fatal assertion {msgid} at {file} {line}",
+ "Fatal assertion",
"msgid"_attr = msgid,
"file"_attr = file,
"line"_attr = line);
@@ -208,9 +216,10 @@ MONGO_COMPILER_NORETURN void fassertFailedWithStatusWithLocation(int msgid,
const char* file,
unsigned line) noexcept {
LOGV2_FATAL_CONTINUE(23093,
- "Fatal assertion {msgid} {status} at {file} {line}",
+ "Fatal assertion {msgid} {error} at {file} {line}",
+ "Fatal assertion",
"msgid"_attr = msgid,
- "status"_attr = redact(status),
+ "error"_attr = redact(status),
"file"_attr = file,
"line"_attr = line);
breakpoint();
@@ -223,9 +232,10 @@ MONGO_COMPILER_NORETURN void fassertFailedWithStatusNoTraceWithLocation(int msgi
const char* file,
unsigned line) noexcept {
LOGV2_FATAL_CONTINUE(23095,
- "Fatal assertion {msgid} {status} at {file} {line}",
+ "Fatal assertion {msgid} {error} at {file} {line}",
+ "Fatal assertion",
"msgid"_attr = msgid,
- "status"_attr = redact(status),
+ "error"_attr = redact(status),
"file"_attr = file,
"line"_attr = line);
breakpoint();
@@ -239,8 +249,9 @@ MONGO_COMPILER_NOINLINE void uassertedWithLocation(const Status& status,
assertionCount.condrollover(assertionCount.user.addAndFetch(1));
LOGV2_DEBUG(23074,
1,
- "User Assertion: {status} {file} {line}",
- "status"_attr = redact(status),
+ "User assertion {error} {file} {line}",
+ "User assertion",
+ "error"_attr = redact(status),
"file"_attr = file,
"line"_attr = line);
error_details::throwExceptionForStatus(status);
@@ -251,8 +262,9 @@ MONGO_COMPILER_NOINLINE void msgassertedWithLocation(const Status& status,
unsigned line) {
assertionCount.condrollover(assertionCount.msg.addAndFetch(1));
LOGV2_ERROR(23077,
- "Assertion: {status} {file} {line}",
- "status"_attr = redact(status),
+ "Assertion {error} {file} {line}",
+ "Assertion",
+ "error"_attr = redact(status),
"file"_attr = file,
"line"_attr = line);
error_details::throwExceptionForStatus(status);
diff --git a/src/mongo/util/background.cpp b/src/mongo/util/background.cpp
index d1db0ce6ee3..1cc2c497c4c 100644
--- a/src/mongo/util/background.cpp
+++ b/src/mongo/util/background.cpp
@@ -55,6 +55,10 @@ namespace {
class PeriodicTaskRunner : public BackgroundJob {
public:
+ // Tasks are expected to finish reasonably quickly, so when a task run takes longer
+ // than `kMinLog`, the verbosity of its summary log statement is upgraded from 3 to 0.
+ static constexpr auto kMinLog = Milliseconds(100);
+
PeriodicTaskRunner() : _shutdownRequested(false) {}
void add(PeriodicTask* task);
@@ -147,7 +151,11 @@ void BackgroundJob::jobBody() {
setThreadName(threadName);
}
- LOGV2_DEBUG(23098, 1, "BackgroundJob starting: {threadName}", "threadName"_attr = threadName);
+ LOGV2_DEBUG(23098,
+ 1,
+ "BackgroundJob starting: {threadName}",
+ "BackgroundJob starting",
+ "threadName"_attr = threadName);
run();
@@ -334,21 +342,25 @@ void PeriodicTaskRunner::_runTask(PeriodicTask* const task) {
task->taskDoWork();
} catch (const std::exception& e) {
LOGV2_ERROR(23100,
- "task: {taskName} failed: {e_what}",
+ "Task: {taskName} failed: {error}",
+ "Task failed",
"taskName"_attr = taskName,
- "e_what"_attr = redact(e.what()));
+ "error"_attr = redact(e.what()));
} catch (...) {
- LOGV2_ERROR(
- 23101, "task: {taskName} failed with unknown error", "taskName"_attr = taskName);
+ LOGV2_ERROR(23101,
+ "Task: {taskName} failed with unknown error",
+ "Task failed with unknown error",
+ "taskName"_attr = taskName);
}
- const int ms = timer.millis();
- const int kMinLogMs = 100;
+ const auto duration = timer.elapsed();
+
LOGV2_DEBUG(23099,
- logSeverityV1toV2(ms <= kMinLogMs ? 3 : 0).toInt(),
- "task: {taskName} took: {ms}ms",
+ logSeverityV1toV2(duration <= kMinLog ? 3 : 0).toInt(),
+ "Task: {taskName} took: {duration}",
+ "Task finished",
"taskName"_attr = taskName,
- "ms"_attr = ms);
+ "duration"_attr = duration_cast<Milliseconds>(duration));
}
} // namespace mongo
diff --git a/src/mongo/util/concurrency/thread_name.cpp b/src/mongo/util/concurrency/thread_name.cpp
index 73444d5e6bc..9f31f2596f6 100644
--- a/src/mongo/util/concurrency/thread_name.cpp
+++ b/src/mongo/util/concurrency/thread_name.cpp
@@ -133,8 +133,9 @@ void setThreadName(StringData name) {
int error = pthread_setname_np(threadNameCopy.c_str());
if (error) {
LOGV2(23102,
- "Ignoring error from setting thread name: {errnoWithDescription_error}",
- "errnoWithDescription_error"_attr = errnoWithDescription(error));
+ "Ignoring error from setting thread name: {error}",
+ "Ignoring error from setting thread name",
+ "error"_attr = errnoWithDescription(error));
}
#elif defined(__linux__) && defined(MONGO_CONFIG_HAVE_PTHREAD_SETNAME_NP)
// Do not set thread name on the main() thread. Setting the name on main thread breaks
@@ -156,8 +157,9 @@ void setThreadName(StringData name) {
if (error) {
LOGV2(23103,
- "Ignoring error from setting thread name: {errnoWithDescription_error}",
- "errnoWithDescription_error"_attr = errnoWithDescription(error));
+ "Ignoring error from setting thread name: {error}",
+ "Ignoring error from setting thread name",
+ "error"_attr = errnoWithDescription(error));
}
}
#endif
diff --git a/src/mongo/util/concurrency/thread_pool.cpp b/src/mongo/util/concurrency/thread_pool.cpp
index e6b38e4b90f..f2e10b5ac58 100644
--- a/src/mongo/util/concurrency/thread_pool.cpp
+++ b/src/mongo/util/concurrency/thread_pool.cpp
@@ -64,19 +64,21 @@ ThreadPool::Options cleanUpOptions(ThreadPool::Options&& options) {
}
if (options.maxThreads < 1) {
LOGV2_FATAL(28702,
- "Tried to create pool {options_poolName} with a maximum of "
- "{options_maxThreads} but the maximum must be at least 1",
- "options_poolName"_attr = options.poolName,
- "options_maxThreads"_attr = options.maxThreads);
+ "Cannot create pool {poolName} with maximum number of threads of "
+ "{maxThreads} which is less than 1",
+ "Cannot create pool with maximum number of threads less than 1",
+ "poolName"_attr = options.poolName,
+ "maxThreads"_attr = options.maxThreads);
}
if (options.minThreads > options.maxThreads) {
- LOGV2_FATAL(
- 28686,
- "Tried to create pool {options_poolName} with a minimum of {options_minThreads} which "
- "is more than the configured maximum of {options_maxThreads}",
- "options_poolName"_attr = options.poolName,
- "options_minThreads"_attr = options.minThreads,
- "options_maxThreads"_attr = options.maxThreads);
+ LOGV2_FATAL(28686,
+ "Cannot create pool {poolName} with minimum number of threads of "
+ "{minThreads} which is larger than the configured maximum of {maxThreads}",
+ "Cannot create pool with minimum number of threads larger than the "
+ "configured maximum",
+ "poolName"_attr = options.poolName,
+ "minThreads"_attr = options.minThreads,
+ "maxThreads"_attr = options.maxThreads);
}
return {std::move(options)};
}
@@ -103,8 +105,9 @@ void ThreadPool::startup() {
stdx::lock_guard<Latch> lk(_mutex);
if (_state != preStart) {
LOGV2_FATAL(28698,
- "Attempting to start pool {options_poolName}, but it has already started",
- "options_poolName"_attr = _options.poolName);
+ "Attempted to start pool {poolName}, but it has already started",
+ "Attempted to start pool that has already started",
+ "poolName"_attr = _options.poolName);
}
_setState_inlock(running);
invariant(_threads.empty());
@@ -161,8 +164,9 @@ void ThreadPool::_join_inlock(stdx::unique_lock<Latch>* lk) {
case joining:
case shutdownComplete:
LOGV2_FATAL(28700,
- "Attempted to join pool {options_poolName} more than once",
- "options_poolName"_attr = _options.poolName);
+ "Attempted to join pool {poolName} more than once",
+ "Attempted to join pool more than once",
+ "poolName"_attr = _options.poolName);
}
MONGO_UNREACHABLE;
});
@@ -260,7 +264,12 @@ void ThreadPool::_workerThreadBody(ThreadPool* pool, const std::string& threadNa
setThreadName(threadName);
pool->_options.onCreateThread(threadName);
const auto poolName = pool->_options.poolName;
- LOGV2_DEBUG(23104, 1, "starting thread in pool {poolName}", "poolName"_attr = poolName);
+ LOGV2_DEBUG(23104,
+ 1,
+ "Starting thread {threadName} in pool {poolName}",
+ "Starting thread",
+ "threadName"_attr = threadName,
+ "poolName"_attr = poolName);
pool->_consumeTasks();
// At this point, another thread may have destroyed "pool", if this thread chose to detach
@@ -270,7 +279,12 @@ void ThreadPool::_workerThreadBody(ThreadPool* pool, const std::string& threadNa
// This can happen if this thread decided to retire, got descheduled after removing itself
// from _threads and calling detach(), and then the pool was deleted. When this thread resumes,
// it is no longer safe to access "pool".
- LOGV2_DEBUG(23105, 1, "shutting down thread in pool {poolName}", "poolName"_attr = poolName);
+ LOGV2_DEBUG(23105,
+ 1,
+ "Shutting down thread {threadName} in pool {poolName}",
+ "Shutting down thread",
+ "threadName"_attr = threadName,
+ "poolName"_attr = poolName);
}
void ThreadPool::_consumeTasks() {
@@ -296,16 +310,18 @@ void ThreadPool::_consumeTasks() {
LOGV2_DEBUG(23106,
1,
"Reaping this thread; next thread reaped no earlier than "
- "{lastFullUtilizationDate_options_maxIdleThreadAge}",
- "lastFullUtilizationDate_options_maxIdleThreadAge"_attr =
+ "{nextThreadRetirementDate}",
+ "Reaping this thread",
+ "nextThreadRetirementDate"_attr =
_lastFullUtilizationDate + _options.maxIdleThreadAge);
break;
}
LOGV2_DEBUG(23107,
3,
- "Not reaping because the earliest retirement date is "
+ "Not reaping this thread because the earliest retirement date is "
"{nextThreadRetirementDate}",
+ "Not reaping this thread",
"nextThreadRetirementDate"_attr = nextThreadRetirementDate);
MONGO_IDLE_THREAD_BLOCK;
_workAvailable.wait_until(lk, nextThreadRetirementDate.toSystemTimePoint());
@@ -316,10 +332,11 @@ void ThreadPool::_consumeTasks() {
// would be eligible for retirement once they had no work left to do.
LOGV2_DEBUG(23108,
3,
- "waiting for work; I am one of {threads_size} thread(s); the minimum "
- "number of threads is {options_minThreads}",
- "threads_size"_attr = _threads.size(),
- "options_minThreads"_attr = _options.minThreads);
+ "Waiting for work; the thread pool size is {numThreads}; the minimum "
+ "number of threads is {minThreads}",
+ "Waiting for work",
+ "numThreads"_attr = _threads.size(),
+ "minThreads"_attr = _options.minThreads);
MONGO_IDLE_THREAD_BLOCK;
_workAvailable.wait(lk);
}
@@ -344,13 +361,13 @@ void ThreadPool::_consumeTasks() {
--_numIdleThreads;
if (_state != running) {
- LOGV2_FATAL_NOTRACE(
- 28701,
- "State of pool {options_poolName} is {static_cast_int32_t_state}, but expected "
- "{static_cast_int32_t_running}",
- "options_poolName"_attr = _options.poolName,
- "static_cast_int32_t_state"_attr = static_cast<int32_t>(_state),
- "static_cast_int32_t_running"_attr = static_cast<int32_t>(running));
+ LOGV2_FATAL_NOTRACE(28701,
+ "State of pool {poolName} is {actualState}, but expected "
+ "{expectedState}",
+ "Unexpected pool state",
+ "poolName"_attr = _options.poolName,
+ "actualState"_attr = static_cast<int32_t>(_state),
+ "expectedState"_attr = static_cast<int32_t>(running));
}
// This thread is ending because it was idle for too long. Find self in _threads, remove self
@@ -369,17 +386,19 @@ void ThreadPool::_consumeTasks() {
std::ostringstream threadId;
threadId << stdx::this_thread::get_id();
LOGV2_FATAL_NOTRACE(28703,
- "Could not find this thread, with id {threadId} in pool {pool}",
+ "Could not find thread with id {threadId} in pool {poolName}",
+ "Could not find thread",
"threadId"_attr = threadId.str(),
- "pool"_attr = _options.poolName);
+ "poolName"_attr = _options.poolName);
}
void ThreadPool::_doOneTask(stdx::unique_lock<Latch>* lk) noexcept {
invariant(!_pendingTasks.empty());
LOGV2_DEBUG(23109,
3,
- "Executing a task on behalf of pool {options_poolName}",
- "options_poolName"_attr = _options.poolName);
+ "Executing a task on behalf of pool {poolName}",
+ "Executing a task on behalf of pool",
+ "poolName"_attr = _options.poolName);
Task task = std::move(_pendingTasks.front());
_pendingTasks.pop_front();
--_numIdleThreads;
@@ -395,19 +414,22 @@ void ThreadPool::_doOneTask(stdx::unique_lock<Latch>* lk) noexcept {
void ThreadPool::_startWorkerThread_inlock() {
switch (_state) {
case preStart:
- LOGV2_DEBUG(23110,
- 1,
- "Not starting new thread in pool {options_poolName}, yet; waiting for "
- "startup() call",
- "options_poolName"_attr = _options.poolName);
+ LOGV2_DEBUG(
+ 23110,
+ 1,
+ "Not starting new thread in pool {poolName}, yet; waiting for "
+ "startup() call",
+ "Not starting new thread since the pool is still waiting for startup() call",
+ "poolName"_attr = _options.poolName);
return;
case joinRequired:
case joining:
case shutdownComplete:
LOGV2_DEBUG(23111,
1,
- "Not starting new thread in pool {options_poolName} while shutting down",
- "options_poolName"_attr = _options.poolName);
+ "Not starting new thread in pool {poolName}; shutting down",
+ "Not starting new thread since the pool is shutting down",
+ "poolName"_attr = _options.poolName);
return;
case running:
break;
@@ -417,10 +439,11 @@ void ThreadPool::_startWorkerThread_inlock() {
if (_threads.size() == _options.maxThreads) {
LOGV2_DEBUG(23112,
2,
- "Not starting new thread in pool {options_poolName} because it already has "
- "{options_maxThreads}, its maximum",
- "options_poolName"_attr = _options.poolName,
- "options_maxThreads"_attr = _options.maxThreads);
+ "Not starting new thread in pool {poolName} because it already has "
+ "{maxThreads} threads, its maximum",
+ "Not starting new thread in pool since the pool is already full",
+ "poolName"_attr = _options.poolName,
+ "maxThreads"_attr = _options.maxThreads);
return;
}
invariant(_threads.size() < _options.maxThreads);
@@ -430,12 +453,13 @@ void ThreadPool::_startWorkerThread_inlock() {
++_numIdleThreads;
} catch (const std::exception& ex) {
LOGV2_ERROR(23113,
- "Failed to start {threadName}; {threads_size} other thread(s) still running in "
- "pool {options_poolName}; caught exception: {ex_what}",
+ "Failed to start {threadName}; {numThreads} other thread(s) still running in "
+ "pool {poolName}; caught exception: {error}",
+ "Failed to start thread",
"threadName"_attr = threadName,
- "threads_size"_attr = _threads.size(),
- "options_poolName"_attr = _options.poolName,
- "ex_what"_attr = redact(ex.what()));
+ "numThreads"_attr = _threads.size(),
+ "poolName"_attr = _options.poolName,
+ "error"_attr = redact(ex.what()));
}
}
diff --git a/src/mongo/util/concurrency/thread_pool_test.cpp b/src/mongo/util/concurrency/thread_pool_test.cpp
index 7a9f7f9eef9..175bc69e00a 100644
--- a/src/mongo/util/concurrency/thread_pool_test.cpp
+++ b/src/mongo/util/concurrency/thread_pool_test.cpp
@@ -186,7 +186,9 @@ TEST_F(ThreadPoolTest, MaxPoolSize20MinPoolSize15) {
<< "Failed to reap excess threads after " << durationCount<Milliseconds>(reapTime) << "ms";
}
-DEATH_TEST_REGEX(ThreadPoolTest, MaxThreadsTooFewDies, "but the maximum must be at least 1") {
+DEATH_TEST_REGEX(ThreadPoolTest,
+ MaxThreadsTooFewDies,
+ "Cannot create pool.*with maximum number of threads.*less than 1") {
ThreadPool::Options options;
options.maxThreads = 0;
ThreadPool pool(options);
@@ -195,7 +197,7 @@ DEATH_TEST_REGEX(ThreadPoolTest, MaxThreadsTooFewDies, "but the maximum must be
DEATH_TEST_REGEX(
ThreadPoolTest,
MinThreadsTooManyDies,
- R"#(.*which is more than the configured maximum of.*minThreads":6,"options_maxThreads":5)#") {
+ R"#(.*Cannot create pool.*with minimum number of threads.*larger than the configured maximum.*minThreads":6,"maxThreads":5)#") {
ThreadPool::Options options;
options.maxThreads = 5;
options.minThreads = 6;
@@ -213,7 +215,7 @@ TEST(ThreadPoolTest, LivePoolCleanedByDestructor) {
DEATH_TEST_REGEX(ThreadPoolTest,
DestructionDuringJoinDies,
- "Attempted to join pool .* more than once.*DoubleJoinPool") {
+ "Attempted to join pool.*more than once.*DoubleJoinPool") {
// This test is a little complicated. We need to ensure that the ThreadPool destructor runs
// while some thread is blocked running ThreadPool::join, to see that double-join is fatal in
// the pool destructor. To do this, we first wait for minThreads threads to have started. Then,
diff --git a/src/mongo/util/concurrency/thread_pool_test_common.cpp b/src/mongo/util/concurrency/thread_pool_test_common.cpp
index 4be2d415a77..cab44595fe3 100644
--- a/src/mongo/util/concurrency/thread_pool_test_common.cpp
+++ b/src/mongo/util/concurrency/thread_pool_test_common.cpp
@@ -80,6 +80,7 @@ public:
if (entry) {
LOGV2_FATAL(34355,
"Multiple attempts to register ThreadPoolTest named {name}",
+ "Multiple attempts to register ThreadPoolTest",
"name"_attr = name);
}
entry = std::move(makeTest);
@@ -97,6 +98,7 @@ public:
if (entry) {
LOGV2_FATAL(34356,
"Multiple attempts to register ThreadPoolDeathTest named {name}",
+ "Multiple attempts to register ThreadPoolDeathTest",
"name"_attr = name);
}
entry = [makeTest](ThreadPoolFactory makeThreadPool) {
@@ -151,7 +153,7 @@ COMMON_THREAD_POOL_TEST(CannotScheduleAfterShutdown) {
pool.schedule([](auto status) { ASSERT_EQ(status, ErrorCodes::ShutdownInProgress); });
}
-COMMON_THREAD_POOL_DEATH_TEST(DieOnDoubleStartUp, "it has already started") {
+COMMON_THREAD_POOL_DEATH_TEST(DieOnDoubleStartUp, "already started") {
auto& pool = getThreadPool();
pool.startup();
pool.startup();
diff --git a/src/mongo/util/concurrency/with_lock_test.cpp b/src/mongo/util/concurrency/with_lock_test.cpp
index 8f3b7e3cda0..e48f5a2a16d 100644
--- a/src/mongo/util/concurrency/with_lock_test.cpp
+++ b/src/mongo/util/concurrency/with_lock_test.cpp
@@ -63,10 +63,7 @@ private:
return _blerp(lk, i);
}
int _blerp(WithLock, int i) {
- LOGV2(23122,
- "{i} bleep{i_1_n_s_n}",
- "i"_attr = i,
- "i_1_n_s_n"_attr = (i == 1 ? "\n" : "s\n"));
+ LOGV2(23122, "{i} bleep(s)\n", "i"_attr = i);
return i;
}
Mutex _m = MONGO_MAKE_LATCH("Beerp::_m");
diff --git a/src/mongo/util/diagnostic_info.cpp b/src/mongo/util/diagnostic_info.cpp
index 65895ebbc32..9adf6b9d9e6 100644
--- a/src/mongo/util/diagnostic_info.cpp
+++ b/src/mongo/util/diagnostic_info.cpp
@@ -156,8 +156,9 @@ void BlockedOp::join() {
void BlockedOp::setIsContended(bool value) {
LOGV2(23128,
- "Setting isContended to {value_true_false}",
- "value_true_false"_attr = (value ? "true" : "false"));
+ "Setting isContended to {value}",
+ "Setting isContended",
+ "value"_attr = (value ? "true" : "false"));
stdx::lock_guard lk(_m);
_latchState.isContended = value;
_cv.notify_one();
@@ -165,8 +166,9 @@ void BlockedOp::setIsContended(bool value) {
void BlockedOp::setIsWaiting(bool value) {
LOGV2(23129,
- "Setting isWaiting to {value_true_false}",
- "value_true_false"_attr = (value ? "true" : "false"));
+ "Setting isWaiting to {value}",
+ "Setting isWaiting",
+ "value"_attr = (value ? "true" : "false"));
stdx::lock_guard lk(_m);
_interruptibleState.isWaiting = value;
_cv.notify_one();
diff --git a/src/mongo/util/exception_filter_win32.cpp b/src/mongo/util/exception_filter_win32.cpp
index 1cd8993eea1..1a6b5099643 100644
--- a/src/mongo/util/exception_filter_win32.cpp
+++ b/src/mongo/util/exception_filter_win32.cpp
@@ -64,8 +64,9 @@ void doMinidumpWithException(struct _EXCEPTION_POINTERS* exceptionInfo) {
if (ret == 0) {
int gle = GetLastError();
LOGV2(23130,
- "GetModuleFileName failed {errnoWithDescription_gle}",
- "errnoWithDescription_gle"_attr = errnoWithDescription(gle));
+ "GetModuleFileName failed {error}",
+ "GetModuleFileName failed",
+ "error"_attr = errnoWithDescription(gle));
// Fallback name
wcscpy_s(moduleFileName, L"mongo");
@@ -91,10 +92,10 @@ void doMinidumpWithException(struct _EXCEPTION_POINTERS* exceptionInfo) {
if (INVALID_HANDLE_VALUE == hFile) {
DWORD lasterr = GetLastError();
LOGV2(23131,
- "failed to open minidump file {toUtf8String_dumpName_c_str} : "
- "{errnoWithDescription_lasterr}",
- "toUtf8String_dumpName_c_str"_attr = toUtf8String(dumpName.c_str()),
- "errnoWithDescription_lasterr"_attr = errnoWithDescription(lasterr));
+ "Failed to open minidump file {dumpName}: {error}",
+ "Failed to open minidump file",
+ "dumpName"_attr = toUtf8String(dumpName.c_str()),
+ "error"_attr = errnoWithDescription(lasterr));
return;
}
@@ -111,8 +112,9 @@ void doMinidumpWithException(struct _EXCEPTION_POINTERS* exceptionInfo) {
MiniDumpWithProcessThreadData);
#endif
LOGV2(23132,
- "writing minidump diagnostic file {toUtf8String_dumpName_c_str}",
- "toUtf8String_dumpName_c_str"_attr = toUtf8String(dumpName.c_str()));
+ "Writing minidump diagnostic file {dumpName}",
+ "Writing minidump diagnostic file",
+ "dumpName"_attr = toUtf8String(dumpName.c_str()));
BOOL bstatus = MiniDumpWriteDump(GetCurrentProcess(),
GetCurrentProcessId(),
@@ -124,8 +126,9 @@ void doMinidumpWithException(struct _EXCEPTION_POINTERS* exceptionInfo) {
if (FALSE == bstatus) {
DWORD lasterr = GetLastError();
LOGV2(23133,
- "failed to create minidump : {errnoWithDescription_lasterr}",
- "errnoWithDescription_lasterr"_attr = errnoWithDescription(lasterr));
+ "Failed to create minidump: {error}",
+ "Failed to create minidump",
+ "error"_attr = errnoWithDescription(lasterr));
}
CloseHandle(hFile);
@@ -148,6 +151,7 @@ LONG WINAPI exceptionFilter(struct _EXCEPTION_POINTERS* excPointers) {
LOGV2_FATAL_CONTINUE(
23134,
"*** unhandled exception {exceptionString} at {addressString}, terminating",
+ "Unhandled exception",
"exceptionString"_attr = exceptionString,
"addressString"_attr = addressString);
if (excPointers->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION) {
@@ -172,9 +176,10 @@ LONG WINAPI exceptionFilter(struct _EXCEPTION_POINTERS* excPointers) {
" 0x%llx",
excPointers->ExceptionRecord->ExceptionInformation[1]);
LOGV2_FATAL_CONTINUE(23135,
- "*** access violation was a {acTypeString}{addressString}",
- "acTypeString"_attr = acTypeString,
- "addressString"_attr = addressString);
+ "*** access violation was a {accessType}{address}",
+ "Access violation",
+ "accessType"_attr = acTypeString,
+ "address"_attr = addressString);
}
LOGV2_FATAL_CONTINUE(23136, "*** stack trace for unhandled exception:");
diff --git a/src/mongo/util/exit.cpp b/src/mongo/util/exit.cpp
index 9bf0fcfe5b3..bb61190afde 100644
--- a/src/mongo/util/exit.cpp
+++ b/src/mongo/util/exit.cpp
@@ -68,7 +68,7 @@ void runTasks(decltype(shutdownTasks) tasks, const ShutdownTaskArgs& shutdownArg
// has its own 'quickExitMutex' to prohibit multiple threads from attempting to call _exit().
MONGO_COMPILER_NORETURN void logAndQuickExit_inlock() {
ExitCode code = shutdownExitCode.get();
- LOGV2(23138, "shutting down with code:{code}", "code"_attr = code);
+ LOGV2(23138, "Shutting down with code: {exitCode}", "Shutting down", "exitCode"_attr = code);
quickExit(code);
}
@@ -115,11 +115,12 @@ void shutdown(ExitCode code, const ShutdownTaskArgs& shutdownArgs) {
if (code != originallyRequestedCode) {
LOGV2(23139,
"While running shutdown tasks with the intent to exit with code "
- "{originallyRequestedCode}, an additional shutdown request arrived with "
- "the intent to exit with a different exit code {code}; ignoring the "
- "conflicting exit code",
- "originallyRequestedCode"_attr = originallyRequestedCode,
- "code"_attr = code);
+ "{originalExitCode}, an additional shutdown request arrived with "
+ "the intent to exit with a different exit code {newExitCode}; "
+ "ignoring the conflicting exit code",
+ "Conflicting exit code at shutdown",
+ "originalExitCode"_attr = originallyRequestedCode,
+ "newExitCode"_attr = code);
}
// Wait for the shutdown tasks to complete
diff --git a/src/mongo/util/fail_point.cpp b/src/mongo/util/fail_point.cpp
index f439cdd1fbb..1c4fdf934df 100644
--- a/src/mongo/util/fail_point.cpp
+++ b/src/mongo/util/fail_point.cpp
@@ -175,8 +175,9 @@ FailPoint::RetCode FailPoint::_slowShouldFailOpenBlockWithoutIncrementingTimesEn
}
default:
LOGV2_ERROR(23832,
- "FailPoint Mode not supported: {static_cast_int_mode}",
- "static_cast_int_mode"_attr = static_cast<int>(_mode));
+ "FailPoint mode not supported: {mode}",
+ "FailPoint mode not supported",
+ "mode"_attr = static_cast<int>(_mode));
fassertFailed(16444);
}
}
@@ -305,7 +306,8 @@ auto setGlobalFailPoint(const std::string& failPointName, const BSONObj& cmdObj)
uasserted(ErrorCodes::FailPointSetFailed, failPointName + " not found");
auto timesEntered = failPoint->setMode(uassertStatusOK(FailPoint::parseBSON(cmdObj)));
LOGV2_WARNING(23829,
- "failpoint: {failPointName} set to: {failPoint}",
+ "Set failpoint {failPointName} to: {failPoint}",
+ "Set failpoint",
"failPointName"_attr = failPointName,
"failPoint"_attr = failPoint->toBSON());
return timesEntered;
@@ -322,7 +324,8 @@ FailPointEnableBlock::FailPointEnableBlock(std::string failPointName, BSONObj da
_initialTimesEntered = _failPoint->setMode(FailPoint::alwaysOn, 0, std::move(data));
LOGV2_WARNING(23830,
- "failpoint: {failPointName} set to: {failPoint}",
+ "Set failpoint {failPointName} to: {failPoint}",
+ "Set failpoint",
"failPointName"_attr = _failPointName,
"failPoint"_attr = _failPoint->toBSON());
}
@@ -330,7 +333,8 @@ FailPointEnableBlock::FailPointEnableBlock(std::string failPointName, BSONObj da
FailPointEnableBlock::~FailPointEnableBlock() {
_failPoint->setMode(FailPoint::off);
LOGV2_WARNING(23831,
- "failpoint: {failPointName} set to: {failPoint}",
+ "Set failpoint {failPointName} to: {failPoint}",
+ "Set failpoint",
"failPointName"_attr = _failPointName,
"failPoint"_attr = _failPoint->toBSON());
}
diff --git a/src/mongo/util/fail_point_test.cpp b/src/mongo/util/fail_point_test.cpp
index 1687d3bf6c9..96e4cba6be2 100644
--- a/src/mongo/util/fail_point_test.cpp
+++ b/src/mongo/util/fail_point_test.cpp
@@ -180,6 +180,7 @@ private:
using namespace mongo::literals;
LOGV2_ERROR(24129,
"blockTask thread detected anomaly - data: {data}",
+ "blockTask thread detected anomaly",
"data"_attr = data);
ASSERT(false);
}
@@ -199,6 +200,7 @@ private:
using namespace mongo::literals;
LOGV2_ERROR(24130,
"blockWithExceptionTask thread detected anomaly - data: {data}",
+ "blockWithExceptionTask thread detected anomaly",
"data"_attr = data);
ASSERT(false);
}
diff --git a/src/mongo/util/file.cpp b/src/mongo/util/file.cpp
index 6b0fe3c00af..91384979ee9 100644
--- a/src/mongo/util/file.cpp
+++ b/src/mongo/util/file.cpp
@@ -73,10 +73,10 @@ intmax_t File::freeSpace(const std::string& path) {
}
DWORD dosError = GetLastError();
LOGV2(23140,
- "In File::freeSpace(), GetDiskFreeSpaceEx for '{path}' failed with "
- "{errnoWithDescription_dosError}",
+ "In File::freeSpace(), GetDiskFreeSpaceEx for '{path}' failed with {error}",
+ "In File::freeSpace(), GetDiskFreeSpaceEx failed",
"path"_attr = path,
- "errnoWithDescription_dosError"_attr = errnoWithDescription(dosError));
+ "error"_attr = errnoWithDescription(dosError));
return -1;
}
@@ -84,10 +84,10 @@ void File::fsync() const {
if (FlushFileBuffers(_handle) == 0) {
DWORD dosError = GetLastError();
LOGV2(23141,
- "In File::fsync(), FlushFileBuffers for '{name}' failed with "
- "{errnoWithDescription_dosError}",
- "name"_attr = _name,
- "errnoWithDescription_dosError"_attr = errnoWithDescription(dosError));
+ "In File::fsync(), FlushFileBuffers for '{fileName}' failed with {error}",
+ "In File::fsync(), FlushFileBuffers failed",
+ "fileName"_attr = _name,
+ "error"_attr = errnoWithDescription(dosError));
}
}
@@ -103,9 +103,10 @@ fileofs File::len() {
_bad = true;
DWORD dosError = GetLastError();
LOGV2(23142,
- "In File::len(), GetFileSizeEx for '{name}' failed with {errnoWithDescription_dosError}",
- "name"_attr = _name,
- "errnoWithDescription_dosError"_attr = errnoWithDescription(dosError));
+ "In File::len(), GetFileSizeEx for '{fileName}' failed with {error}",
+ "In File::len(), GetFileSizeEx failed",
+ "fileName"_attr = _name,
+ "error"_attr = errnoWithDescription(dosError));
return 0;
}
@@ -121,11 +122,11 @@ void File::open(const char* filename, bool readOnly, bool direct) {
_bad = !is_open();
if (_bad) {
DWORD dosError = GetLastError();
- LOGV2(
- 23143,
- "In File::open(), CreateFileW for '{name}' failed with {errnoWithDescription_dosError}",
- "name"_attr = _name,
- "errnoWithDescription_dosError"_attr = errnoWithDescription(dosError));
+ LOGV2(23143,
+ "In File::open(), CreateFileW for '{fileName}' failed with {error}",
+ "In File::open(), CreateFileW failed",
+ "fileName"_attr = _name,
+ "error"_attr = errnoWithDescription(dosError));
}
}
@@ -136,11 +137,12 @@ void File::read(fileofs o, char* data, unsigned len) {
_bad = true;
DWORD dosError = GetLastError();
LOGV2(23144,
- "In File::read(), SetFilePointerEx for '{name}' tried to set the file pointer to {o} "
- "but failed with {errnoWithDescription_dosError}",
- "name"_attr = _name,
- "o"_attr = o,
- "errnoWithDescription_dosError"_attr = errnoWithDescription(dosError));
+ "In File::read(), SetFilePointerEx for '{fileName}' tried to set the file pointer to "
+ "{failPointer} but failed with {error}",
+ "In File::read(), SetFilePointerEx failed to set file pointer",
+ "fileName"_attr = _name,
+ "failPointer"_attr = o,
+ "error"_attr = errnoWithDescription(dosError));
return;
}
DWORD bytesRead;
@@ -148,9 +150,10 @@ void File::read(fileofs o, char* data, unsigned len) {
_bad = true;
DWORD dosError = GetLastError();
LOGV2(23145,
- "In File::read(), ReadFile for '{name}' failed with {errnoWithDescription_dosError}",
- "name"_attr = _name,
- "errnoWithDescription_dosError"_attr = errnoWithDescription(dosError));
+ "In File::read(), ReadFile for '{fileName}' failed with {error}",
+ "In File::read(), ReadFile failed",
+ "fileName"_attr = _name,
+ "error"_attr = errnoWithDescription(dosError));
} else if (bytesRead != len) {
_bad = true;
msgasserted(10438,
@@ -170,21 +173,22 @@ void File::truncate(fileofs size) {
_bad = true;
DWORD dosError = GetLastError();
LOGV2(23146,
- "In File::truncate(), SetFilePointerEx for '{name}' tried to set the file pointer to "
- "{size} but failed with {errnoWithDescription_dosError}",
- "name"_attr = _name,
- "size"_attr = size,
- "errnoWithDescription_dosError"_attr = errnoWithDescription(dosError));
+ "In File::truncate(), SetFilePointerEx for '{fileName}' tried to set the file "
+ "pointer to {filePointer} but failed with {error}",
+ "In File::truncate(), SetFilePointerEx failed to set file pointer",
+ "fileName"_attr = _name,
+ "filePointer"_attr = size,
+ "error"_attr = errnoWithDescription(dosError));
return;
}
if (SetEndOfFile(_handle) == 0) {
_bad = true;
DWORD dosError = GetLastError();
LOGV2(23147,
- "In File::truncate(), SetEndOfFile for '{name}' failed with "
- "{errnoWithDescription_dosError}",
- "name"_attr = _name,
- "errnoWithDescription_dosError"_attr = errnoWithDescription(dosError));
+ "In File::truncate(), SetEndOfFile for '{fileName}' failed with {error}",
+ "In File::truncate(), SetEndOfFile failed",
+ "fileName"_attr = _name,
+ "error"_attr = errnoWithDescription(dosError));
}
}
@@ -194,12 +198,14 @@ void File::write(fileofs o, const char* data, unsigned len) {
if (SetFilePointerEx(_handle, li, nullptr, FILE_BEGIN) == 0) {
_bad = true;
DWORD dosError = GetLastError();
- LOGV2(23148,
- "In File::write(), SetFilePointerEx for '{name}' tried to set the file pointer to "
- "{o} but failed with {errnoWithDescription_dosError}",
- "name"_attr = _name,
- "o"_attr = o,
- "errnoWithDescription_dosError"_attr = errnoWithDescription(dosError));
+ LOGV2(
+ 23148,
+ "In File::write(), SetFilePointerEx for '{fileName}' tried to set the file pointer to "
+ "{filePointer} but failed with {error}",
+ "In File::write(), SetFilePointerEx failed to set file pointer",
+ "fileName"_attr = _name,
+ "filePointer"_attr = o,
+ "error"_attr = errnoWithDescription(dosError));
return;
}
DWORD bytesWritten;
@@ -207,12 +213,13 @@ void File::write(fileofs o, const char* data, unsigned len) {
_bad = true;
DWORD dosError = GetLastError();
LOGV2(23149,
- "In File::write(), WriteFile for '{name}' tried to write {len} bytes but only wrote "
- "{bytesWritten} bytes, failing with {errnoWithDescription_dosError}",
- "name"_attr = _name,
- "len"_attr = len,
+ "In File::write(), WriteFile for '{fileName}' tried to write {bytesToWrite} bytes "
+ "but only wrote {bytesWritten} bytes, failing with {error}",
+ "In File::write(), WriteFile failed",
+ "fileName"_attr = _name,
+ "bytesToWrite"_attr = len,
"bytesWritten"_attr = bytesWritten,
- "errnoWithDescription_dosError"_attr = errnoWithDescription(dosError));
+ "error"_attr = errnoWithDescription(dosError));
}
}
@@ -233,18 +240,20 @@ intmax_t File::freeSpace(const std::string& path) {
return static_cast<intmax_t>(info.f_bavail) * info.f_frsize;
}
LOGV2(23150,
- "In File::freeSpace(), statvfs for '{path}' failed with {errnoWithDescription}",
+ "In File::freeSpace(), statvfs for '{path}' failed with {error}",
+ "In File::freeSpace(), statvfs failed",
"path"_attr = path,
- "errnoWithDescription"_attr = errnoWithDescription());
+ "error"_attr = errnoWithDescription());
return -1;
}
void File::fsync() const {
if (::fsync(_fd)) {
LOGV2(23151,
- "In File::fsync(), ::fsync for '{name}' failed with {errnoWithDescription}",
- "name"_attr = _name,
- "errnoWithDescription"_attr = errnoWithDescription());
+ "In File::fsync(), ::fsync for '{fileName}' failed with {error}",
+ "In File::fsync(), ::fsync failed",
+ "fileName"_attr = _name,
+ "error"_attr = errnoWithDescription());
}
}
@@ -259,9 +268,10 @@ fileofs File::len() {
}
_bad = true;
LOGV2(23152,
- "In File::len(), lseek for '{name}' failed with {errnoWithDescription}",
- "name"_attr = _name,
- "errnoWithDescription"_attr = errnoWithDescription());
+ "In File::len(), lseek for '{fileName}' failed with {error}",
+ "In File::len(), lseek failed",
+ "fileName"_attr = _name,
+ "error"_attr = errnoWithDescription());
return 0;
}
@@ -281,9 +291,10 @@ void File::open(const char* filename, bool readOnly, bool direct) {
_bad = !is_open();
if (_bad) {
LOGV2(23153,
- "In File::open(), ::open for '{name}' failed with {errnoWithDescription}",
- "name"_attr = _name,
- "errnoWithDescription"_attr = errnoWithDescription());
+ "In File::open(), ::open for '{fileName}' failed with {error}",
+ "In File::open(), ::open failed",
+ "fileName"_attr = _name,
+ "error"_attr = errnoWithDescription());
}
}
@@ -292,9 +303,10 @@ void File::read(fileofs o, char* data, unsigned len) {
if (bytesRead == -1) {
_bad = true;
LOGV2(23154,
- "In File::read(), ::pread for '{name}' failed with {errnoWithDescription}",
- "name"_attr = _name,
- "errnoWithDescription"_attr = errnoWithDescription());
+ "In File::read(), ::pread for '{fileName}' failed with {error}",
+ "In File::read(), ::pread failed",
+ "fileName"_attr = _name,
+ "error"_attr = errnoWithDescription());
} else if (bytesRead != static_cast<ssize_t>(len)) {
_bad = true;
msgasserted(16569,
@@ -311,11 +323,12 @@ void File::truncate(fileofs size) {
if (ftruncate(_fd, size) != 0) {
_bad = true;
LOGV2(23155,
- "In File::truncate(), ftruncate for '{name}' tried to set the file pointer to {size} "
- "but failed with {errnoWithDescription}",
- "name"_attr = _name,
- "size"_attr = size,
- "errnoWithDescription"_attr = errnoWithDescription());
+ "In File::truncate(), ftruncate for '{fileName}' tried to set the file pointer to "
+ "{filePointer} but failed with {error}",
+ "In File::truncate(), ftruncate failed to set file pointer",
+ "fileName"_attr = _name,
+ "filePointer"_attr = size,
+ "error"_attr = errnoWithDescription());
return;
}
}
@@ -325,12 +338,13 @@ void File::write(fileofs o, const char* data, unsigned len) {
if (bytesWritten != static_cast<ssize_t>(len)) {
_bad = true;
LOGV2(23156,
- "In File::write(), ::pwrite for '{name}' tried to write {len} bytes but only wrote "
- "{bytesWritten} bytes, failing with {errnoWithDescription}",
- "name"_attr = _name,
- "len"_attr = len,
+ "In File::write(), ::pwrite for '{fileName}' tried to write {bytesToWrite} bytes but "
+ "only wrote {bytesWritten} bytes, failing with {error}",
+ "In File::write(), ::pwrite failed",
+ "fileName"_attr = _name,
+ "bytesToWrite"_attr = len,
"bytesWritten"_attr = bytesWritten,
- "errnoWithDescription"_attr = errnoWithDescription());
+ "error"_attr = errnoWithDescription());
}
}
diff --git a/src/mongo/util/heap_profiler.cpp b/src/mongo/util/heap_profiler.cpp
index 118dd6bc116..ebf2e6be79a 100644
--- a/src/mongo/util/heap_profiler.cpp
+++ b/src/mongo/util/heap_profiler.cpp
@@ -538,9 +538,10 @@ private:
}
stackInfo.stackObj = builder.obj();
LOGV2(23158,
- "heapProfile stack{stackInfo_stackNum}: {stackInfo_stackObj}",
- "stackInfo_stackNum"_attr = stackInfo.stackNum,
- "stackInfo_stackObj"_attr = stackInfo.stackObj);
+ "heapProfile stack {stackNum}: {stackObj}",
+ "heapProfile stack",
+ "stackNum"_attr = stackInfo.stackNum,
+ "stackObj"_attr = stackInfo.stackObj);
}
//
@@ -567,15 +568,18 @@ private:
const size_t stackTableSize = stackHashTable.memorySizeBytes();
const double MB = 1024 * 1024;
LOGV2(23159,
- "sampleIntervalBytes {HeapProfilingSampleIntervalBytes}; maxActiveMemory "
- "{maxActiveMemory_MB} MB; objTableSize {objTableSize_MB} MB; stackTableSize "
- "{stackTableSize_MB} MB",
- "HeapProfilingSampleIntervalBytes"_attr = HeapProfilingSampleIntervalBytes,
- "maxActiveMemory_MB"_attr = maxActiveMemory / MB,
+ "Generating heap profiler serverStatus: sampleIntervalBytes "
+ "{heapProfilingSampleIntervalBytes}; "
+ "maxActiveMemory {maxActiveMemoryMB} MB; objTableSize {objTableSize_MB} MB; "
+ "stackTableSize "
+ "{stackTableSizeMB} MB",
+ "Generating heap profiler serverStatus",
+ "heapProfilingSampleIntervalBytes"_attr = HeapProfilingSampleIntervalBytes,
+ "maxActiveMemoryMB"_attr = maxActiveMemory / MB,
"objTableSize_MB"_attr = objTableSize / MB,
- "stackTableSize_MB"_attr = stackTableSize / MB);
+ "stackTableSizeMB"_attr = stackTableSize / MB);
// print a stack trace to log somap for post-facto symbolization
- LOGV2(23160, "following stack trace is for heap profiler informational purposes");
+ LOGV2(23160, "Following stack trace is for heap profiler informational purposes");
printStackTrace();
logGeneralStats = false;
}
@@ -638,7 +642,7 @@ private:
// importantStacks grows monotonically, so it can accumulate unneeded stacks,
// so we clear it periodically.
if (++numImportantSamples >= kMaxImportantSamples) {
- LOGV2(23161, "clearing importantStacks");
+ LOGV2(23161, "Clearing importantStacks");
importantStacks.clear();
numImportantSamples = 0;
}
diff --git a/src/mongo/util/secure_zero_memory_test.cpp b/src/mongo/util/secure_zero_memory_test.cpp
index d9769f50763..58321c5aa75 100644
--- a/src/mongo/util/secure_zero_memory_test.cpp
+++ b/src/mongo/util/secure_zero_memory_test.cpp
@@ -42,7 +42,7 @@ TEST(SecureZeroMemoryTest, zeroZeroLengthNull) {
ASSERT_TRUE(true);
}
-DEATH_TEST(SecureZeroMemoryTest, zeroNonzeroLengthNull, "Fatal Assertion") {
+DEATH_TEST(SecureZeroMemoryTest, zeroNonzeroLengthNull, "Fatal assertion") {
void* ptr = nullptr;
secureZeroMemory(ptr, 1000);
}