diff options
author | Gabriel Russell <gabriel.russell@mongodb.com> | 2020-03-02 17:48:47 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-04-30 22:13:33 +0000 |
commit | 4ec6541ced5e44f1817f25e5021cda546a69fa5f (patch) | |
tree | 10ff159f074c2ff416bfb269659df7d05ce55762 /src/mongo/db/repl | |
parent | 2c0d99b3d7ba528b2f6bb7336d6c51ffb0efa9f9 (diff) | |
download | mongo-4ec6541ced5e44f1817f25e5021cda546a69fa5f.tar.gz |
SERVER-46568 removing the unittestOutput domain
(cherry picked from commit cdf9ea3b479bbffc1de900884ee10e29e7349bd2)
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r-- | src/mongo/db/repl/all_database_cloner_test.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/repl/initial_syncer_test.cpp | 63 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl_reconfig_test.cpp | 7 |
3 files changed, 46 insertions, 30 deletions
diff --git a/src/mongo/db/repl/all_database_cloner_test.cpp b/src/mongo/db/repl/all_database_cloner_test.cpp index 2da6f3831cb..0b3efb0b66f 100644 --- a/src/mongo/db/repl/all_database_cloner_test.cpp +++ b/src/mongo/db/repl/all_database_cloner_test.cpp @@ -27,7 +27,7 @@ * it in the license file. */ -#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault +#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kDefault #include "mongo/platform/basic.h" @@ -328,7 +328,7 @@ TEST_F(AllDatabaseClonerTest, RetriesListDatabasesButSourceNodeIsDowngraded) { _clock.advance(Minutes(60)); // Bring the server up, but change the wire version to an older one. - unittest::log() << "Bringing mock server back up."; + LOGV2(21053, "Bringing mock server back up."); _mockClient->setWireVersions(WireVersion::SHARDED_TRANSACTIONS, WireVersion::SHARDED_TRANSACTIONS); _mockServer->reboot(); @@ -378,7 +378,7 @@ TEST_F(AllDatabaseClonerTest, RetriesListDatabasesButInitialSyncIdChanges) { _clock.advance(Minutes(60)); // Bring the server up. - unittest::log() << "Bringing mock server back up."; + LOGV2(21052, "Bringing mock server back up."); _mockServer->reboot(); // Clear and change the initial sync ID diff --git a/src/mongo/db/repl/initial_syncer_test.cpp b/src/mongo/db/repl/initial_syncer_test.cpp index a22e52b30b3..e6e833e1690 100644 --- a/src/mongo/db/repl/initial_syncer_test.cpp +++ b/src/mongo/db/repl/initial_syncer_test.cpp @@ -27,6 +27,8 @@ * it in the license file. */ +#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kDefault + #include "mongo/platform/basic.h" #include <iosfwd> @@ -69,6 +71,7 @@ #include "mongo/util/scopeguard.h" #include "mongo/util/str.h" +#include "mongo/logv2/log.h" #include "mongo/unittest/barrier.h" #include "mongo/unittest/unittest.h" @@ -104,7 +107,6 @@ using namespace mongo::repl; using executor::NetworkInterfaceMock; using executor::RemoteCommandRequest; using executor::RemoteCommandResponse; -using unittest::log; using LockGuard = stdx::lock_guard<Latch>; using NetworkGuard = executor::NetworkInterfaceMock::InNetworkGuard; @@ -165,7 +167,9 @@ public: void scheduleNetworkResponse(std::string cmdName, const BSONObj& obj) { NetworkInterfaceMock* net = getNet(); if (!net->hasReadyRequests()) { - log() << "The network doesn't have a request to process for this response: " << obj; + LOGV2(24158, + "The network doesn't have a request to process for this response", + "obj"_attr = obj); } verifyNextRequestCommandName(cmdName); scheduleNetworkResponse(net->getNextReadyRequest(), obj); @@ -176,9 +180,11 @@ public: NetworkInterfaceMock* net = getNet(); Milliseconds millis(0); RemoteCommandResponse response(obj, millis); - log() << "Sending response for network request:"; - log() << " req: " << noi->getRequest().dbname << "." << noi->getRequest().cmdObj; - log() << " resp:" << response; + LOGV2(24159, + "Sending response for network request", + "dbname"_attr = noi->getRequest().dbname, + "cmd"_attr = noi->getRequest().cmdObj, + "response"_attr = response); net->scheduleResponse(noi, net->now(), response); } @@ -186,7 +192,9 @@ public: void scheduleNetworkResponse(std::string cmdName, Status errorStatus) { NetworkInterfaceMock* net = getNet(); if (!getNet()->hasReadyRequests()) { - log() << "The network doesn't have a request to process for the error: " << errorStatus; + LOGV2(24162, + "The network doesn't have a request to process for the error", + "errorStatus"_attr = errorStatus); } verifyNextRequestCommandName(cmdName); net->scheduleResponse(net->getNextReadyRequest(), net->now(), errorStatus); @@ -224,9 +232,9 @@ public: void finishProcessingNetworkResponse() { getNet()->runReadyNetworkOperations(); if (getNet()->hasReadyRequests()) { - log() << "The network has unexpected requests to process, next req:"; - const NetworkInterfaceMock::NetworkOperation& req = *getNet()->getNextReadyRequest(); - log() << req.getDiagnosticString(); + LOGV2(24163, + "The network has unexpected requests to process", + "request"_attr = getNet()->getNextReadyRequest()->getDiagnosticString()); } ASSERT_FALSE(getNet()->hasReadyRequests()); } @@ -314,7 +322,9 @@ protected: // Get collection info from map. const auto collInfo = &_collections[nss]; if (collInfo->stats->initCalled) { - log() << "reusing collection during test which may cause problems, ns:" << nss; + LOGV2(24165, + "reusing collection during test which may cause problems", + "nss"_attr = nss); } auto localLoader = std::make_unique<CollectionBulkLoaderMock>(collInfo->stats); auto status = localLoader->init(secondaryIndexSpecs); @@ -898,8 +908,11 @@ TEST_F(InitialSyncerTest, // Check number of failed attempts in stats. auto progress = initialSyncer->getInitialSyncProgress(); - unittest::log() << "Progress after " << initialSyncMaxAttempts - << " failed attempts: " << progress; + LOGV2(24166, + "Progress after {initialSyncMaxAttempts} failed attempts: {progress}", + "Progress after initialSyncMaxAttempts failed attempts", + "initialSyncMaxAttempts"_attr = initialSyncMaxAttempts, + "progress"_attr = progress); ASSERT_EQUALS(progress.getIntField("failedInitialSyncAttempts"), int(initialSyncMaxAttempts)) << progress; ASSERT_EQUALS(progress.getIntField("maxFailedInitialSyncAttempts"), int(initialSyncMaxAttempts)) @@ -4274,10 +4287,10 @@ TEST_F(InitialSyncerTest, GetInitialSyncProgressReturnsCorrectProgress) { net->runReadyNetworkOperations(); } - log() << "Done playing first failed response"; + LOGV2(24167, "Done playing first failed response"); auto progress = initialSyncer->getInitialSyncProgress(); - log() << "Progress after first failed response: " << progress; + LOGV2(24168, "Progress after first failed response", "progress"_attr = progress); ASSERT_EQUALS(progress.nFields(), 8) << progress; ASSERT_EQUALS(progress.getIntField("failedInitialSyncAttempts"), 0) << progress; ASSERT_EQUALS(progress.getIntField("maxFailedInitialSyncAttempts"), 2) << progress; @@ -4300,7 +4313,7 @@ TEST_F(InitialSyncerTest, GetInitialSyncProgressReturnsCorrectProgress) { // started. getOplogFetcher()->waitForshutdown(); - log() << "Done playing failed responses"; + LOGV2(24169, "Done playing failed responses"); { FailPointEnableBlock clonerFailpoint("hangBeforeClonerStage", kListDatabasesFailPointData); @@ -4334,10 +4347,10 @@ TEST_F(InitialSyncerTest, GetInitialSyncProgressReturnsCorrectProgress) { processSuccessfulFCVFetcherResponseLastStable(); } - log() << "Done playing first successful response"; + LOGV2(24170, "Done playing first successful response"); auto progress = initialSyncer->getInitialSyncProgress(); - log() << "Progress after failure: " << progress; + LOGV2(24171, "Progress after failure", "progress"_attr = progress); ASSERT_EQUALS(progress.nFields(), 8) << progress; ASSERT_EQUALS(progress.getIntField("failedInitialSyncAttempts"), 1) << progress; ASSERT_EQUALS(progress.getIntField("maxFailedInitialSyncAttempts"), 2) << progress; @@ -4425,10 +4438,10 @@ TEST_F(InitialSyncerTest, GetInitialSyncProgressReturnsCorrectProgress) { // applying the first batch. processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(7)}); } - log() << "Done playing all but last successful response"; + LOGV2(24172, "Done playing all but last successful response"); auto progress = initialSyncer->getInitialSyncProgress(); - log() << "Progress after all but last successful response: " << progress; + LOGV2(24173, "Progress after all but last successful response", "progress"_attr = progress); ASSERT_EQUALS(progress.nFields(), 9) << progress; ASSERT_EQUALS(progress.getIntField("failedInitialSyncAttempts"), 1) << progress; ASSERT_EQUALS(progress.getIntField("maxFailedInitialSyncAttempts"), 2) << progress; @@ -4487,7 +4500,7 @@ TEST_F(InitialSyncerTest, GetInitialSyncProgressReturnsCorrectProgress) { net->runReadyNetworkOperations(); } - log() << "waiting for initial sync to verify it completed OK"; + LOGV2(24174, "waiting for initial sync to verify it completed OK"); initialSyncer->join(); ASSERT_OK(_lastApplied.getStatus()); auto dummyEntry = makeOplogEntry(7); @@ -4495,7 +4508,7 @@ TEST_F(InitialSyncerTest, GetInitialSyncProgressReturnsCorrectProgress) { ASSERT_EQUALS(dummyEntry.getWallClockTime(), _lastApplied.getValue().wallTime); progress = initialSyncer->getInitialSyncProgress(); - log() << "Progress at end: " << progress; + LOGV2(24175, "Progress at end", "progress"_attr = progress); ASSERT_EQUALS(progress.nFields(), 11) << progress; ASSERT_EQUALS(progress.getIntField("failedInitialSyncAttempts"), 1) << progress; ASSERT_EQUALS(progress.getIntField("maxFailedInitialSyncAttempts"), 2) << progress; @@ -4591,7 +4604,7 @@ TEST_F(InitialSyncerTest, GetInitialSyncProgressReturnsCorrectProgressForNetwork auto outageStart = net->now(); auto progress = initialSyncer->getInitialSyncProgress(); - log() << "Progress after first network error: " << progress; + LOGV2(24176, "Progress after first network error", "progress"_attr = progress); ASSERT_EQUALS(progress.getField("syncSourceUnreachableSince").date(), outageStart) << progress; ASSERT_EQUALS(progress.getIntField("currentOutageDurationMillis"), 0) << progress; @@ -4611,7 +4624,7 @@ TEST_F(InitialSyncerTest, GetInitialSyncProgressReturnsCorrectProgressForNetwork net->runReadyNetworkOperations(); progress = initialSyncer->getInitialSyncProgress(); - log() << "Progress after failed retry: " << progress; + LOGV2(24177, "Progress after failed retry", "progress"_attr = progress); ASSERT_EQUALS(progress.getField("syncSourceUnreachableSince").date(), outageStart) << progress; ASSERT_EQUALS(progress.getIntField("currentOutageDurationMillis"), 1000) << progress; @@ -4625,7 +4638,7 @@ TEST_F(InitialSyncerTest, GetInitialSyncProgressReturnsCorrectProgressForNetwork net->runReadyNetworkOperations(); progress = initialSyncer->getInitialSyncProgress(); - log() << "Progress after successful retry: " << progress; + LOGV2(24178, "Progress after successful retry", "progress"_attr = progress); ASSERT(progress.getField("syncSourceUnreachableSince").eoo()); ASSERT(progress.getField("currentOutageDurationMillis").eoo()) << progress; ASSERT_EQUALS(progress.getIntField("totalTimeUnreachableMillis"), 2000) << progress; @@ -4646,7 +4659,7 @@ TEST_F(InitialSyncerTest, GetInitialSyncProgressReturnsCorrectProgressForNetwork ASSERT_OK(_lastApplied.getStatus()); auto progress = initialSyncer->getInitialSyncProgress(); - log() << "Progress at end: " << progress; + LOGV2(24179, "Progress at end", "progress"_attr = progress); ASSERT(progress.getField("syncSourceUnreachableSince").eoo()); ASSERT(progress.getField("currentOutageDurationMillis").eoo()) << progress; ASSERT_EQUALS(progress.getIntField("totalTimeUnreachableMillis"), 2000) << progress; diff --git a/src/mongo/db/repl/replication_coordinator_impl_reconfig_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_reconfig_test.cpp index 5fc81e717ce..d4a6fbb276c 100644 --- a/src/mongo/db/repl/replication_coordinator_impl_reconfig_test.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl_reconfig_test.cpp @@ -27,7 +27,7 @@ * it in the license file. */ -#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kReplication +#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kDefault #include "mongo/platform/basic.h" @@ -41,6 +41,7 @@ #include "mongo/db/repl/replication_coordinator_impl.h" #include "mongo/db/repl/replication_coordinator_test_fixture.h" #include "mongo/executor/network_interface_mock.h" +#include "mongo/logv2/log.h" #include "mongo/unittest/log_test.h" #include "mongo/unittest/unittest.h" #include "mongo/util/fail_point.h" @@ -838,7 +839,9 @@ public: stdx::thread reconfigThread = stdx::thread( [&] { status = getReplCoord()->processReplSetReconfig(opCtx, args, &result); }); // Satisfy quorum check with heartbeats. - unittest::log() << "Responding to quorum check with " << quorumHeartbeats << " heartbeats."; + LOGV2(24257, + "Responding to quorum check with heartbeats.", + "heartbeats"_attr = quorumHeartbeats); respondToNHeartbeats(quorumHeartbeats); reconfigThread.join(); |