diff options
author | Tess Avitabile <tess.avitabile@mongodb.com> | 2020-03-12 16:12:49 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-03-17 19:07:37 +0000 |
commit | 759af0dcb8dd4e13fdcdb8a77907b6dabaf7101e (patch) | |
tree | 481ca2fbcabd4af0fb6b95a2882b6ed1f827071c /src/mongo/db/repl/repl_set_commands.cpp | |
parent | f1bb6bdcb18560f829339d750581e36e71b8f4d2 (diff) | |
download | mongo-759af0dcb8dd4e13fdcdb8a77907b6dabaf7101e.tar.gz |
SERVER-46389 Improve replication log line style
Diffstat (limited to 'src/mongo/db/repl/repl_set_commands.cpp')
-rw-r--r-- | src/mongo/db/repl/repl_set_commands.cpp | 68 |
1 files changed, 42 insertions, 26 deletions
diff --git a/src/mongo/db/repl/repl_set_commands.cpp b/src/mongo/db/repl/repl_set_commands.cpp index 1eaa3b63b0b..11ff4550d27 100644 --- a/src/mongo/db/repl/repl_set_commands.cpp +++ b/src/mongo/db/repl/repl_set_commands.cpp @@ -106,7 +106,10 @@ public: const string&, const BSONObj& cmdObj, BSONObjBuilder& result) { - LOGV2(21573, "replSetTest command received: {cmdObj}", "cmdObj"_attr = cmdObj.toString()); + LOGV2(21573, + "replSetTest command received: {cmdObj}", + "replSetTest command received", + "cmdObj"_attr = cmdObj.toString()); auto replCoord = ReplicationCoordinator::get(getGlobalServiceContext()); @@ -125,6 +128,7 @@ public: Milliseconds timeout(timeoutMillis); LOGV2(21574, "replSetTest: waiting {timeout} for member state to become {expectedState}", + "replSetTest: waiting for member state to become expected state", "timeout"_attr = timeout, "expectedState"_attr = expectedState); @@ -139,6 +143,7 @@ public: Milliseconds timeout(timeoutMillis); LOGV2(21575, "replSetTest: waiting {timeout} for applier buffer to finish draining", + "replSetTest: waiting for applier buffer to finish draining", "timeout"_attr = timeout); status = replCoord->waitForDrainFinish(timeout); @@ -285,7 +290,11 @@ void parseReplSetSeedList(ReplicationCoordinatorExternalState* externalState, seedSet.insert(m); // uassert(13101, "can't use localhost in replset host list", !m.isLocalHost()); if (externalState->isSelf(m, getGlobalServiceContext())) { - LOGV2_DEBUG(21576, 1, "ignoring seed {m} (=self)", "m"_attr = m.toString()); + LOGV2_DEBUG(21576, + 1, + "ignoring seed {seed} (=self)", + "Ignoring seed (=self)", + "seed"_attr = m.toString()); } else { seeds->push_back(m); } @@ -325,7 +334,9 @@ public: "no configuration specified. " "Using a default configuration for the set"; result.append("info2", noConfigMessage); - LOGV2(21577, "initiate : {noConfigMessage}", "noConfigMessage"_attr = noConfigMessage); + LOGV2( + 21577, + "Initiate: no configuration specified. Using a default configuration for the set"); ReplicationCoordinatorExternalStateImpl externalState( opCtx->getServiceContext(), @@ -357,8 +368,9 @@ public: b.appendArray("members", members.obj()); configObj = b.obj(); LOGV2(21578, - "created this configuration for initiation : {configObj}", - "configObj"_attr = configObj.toString()); + "created this configuration for initiation : {config}", + "Created configuration for initiation", + "config"_attr = configObj.toString()); } if (configObj.getField("version").eoo()) { @@ -711,12 +723,12 @@ public: rsDelayHeartbeatResponse.execute( [&](const BSONObj& data) { sleepsecs(data["delay"].numberInt()); }); - LOGV2_FOR_HEARTBEATS( - 24095, - 2, - "Received heartbeat request from {cmdObj_getStringField_from}, {cmdObj}", - "cmdObj_getStringField_from"_attr = cmdObj.getStringField("from"), - "cmdObj"_attr = cmdObj); + LOGV2_FOR_HEARTBEATS(24095, + 2, + "Received heartbeat request from {from}, {cmdObj}", + "Received heartbeat request", + "from"_attr = cmdObj.getStringField("from"), + "cmdObj"_attr = cmdObj); Status status = Status(ErrorCodes::InternalError, "status not set in heartbeat code"); /* we don't call ReplSetCommand::check() here because heartbeat @@ -729,23 +741,23 @@ public: ReplSetHeartbeatArgsV1 args; uassertStatusOK(args.initialize(cmdObj)); - LOGV2_FOR_HEARTBEATS( - 24096, - 2, - "Processing heartbeat request from {cmdObj_getStringField_from}, {cmdObj}", - "cmdObj_getStringField_from"_attr = cmdObj.getStringField("from"), - "cmdObj"_attr = cmdObj); + LOGV2_FOR_HEARTBEATS(24096, + 2, + "Processing heartbeat request from {from}, {cmdObj}", + "Processing heartbeat request", + "from"_attr = cmdObj.getStringField("from"), + "cmdObj"_attr = cmdObj); ReplSetHeartbeatResponse response; status = ReplicationCoordinator::get(opCtx)->processHeartbeatV1(args, &response); if (status.isOK()) response.addToBSON(&result); - LOGV2_FOR_HEARTBEATS( - 24097, - 2, - "Generated heartbeat response to {cmdObj_getStringField_from}, {response}", - "cmdObj_getStringField_from"_attr = cmdObj.getStringField("from"), - "response"_attr = response); + LOGV2_FOR_HEARTBEATS(24097, + 2, + "Generated heartbeat response to {from}, {response}", + "Generated heartbeat response", + "from"_attr = cmdObj.getStringField("from"), + "response"_attr = response); uassertStatusOK(status); return true; } @@ -768,7 +780,10 @@ public: status = ReplicationCoordinator::get(opCtx)->stepUpIfEligible(skipDryRun); if (!status.isOK()) { - LOGV2(21582, "replSetStepUp request failed{status}", "status"_attr = causedBy(status)); + LOGV2(21582, + "replSetStepUp request failed {error}", + "replSetStepUp request failed", + "error"_attr = causedBy(status)); } uassertStatusOK(status); @@ -804,8 +819,9 @@ public: kFailedWithReplSetAbortPrimaryCatchUpCmd); if (!status.isOK()) { LOGV2(21584, - "replSetAbortPrimaryCatchUp request failed{status}", - "status"_attr = causedBy(status)); + "replSetAbortPrimaryCatchUp request failed {error}", + "replSetAbortPrimaryCatchUp request failed", + "error"_attr = causedBy(status)); } uassertStatusOK(status); return true; |