diff options
Diffstat (limited to 'src/mongo/s/client/version_manager.cpp')
-rw-r--r-- | src/mongo/s/client/version_manager.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/mongo/s/client/version_manager.cpp b/src/mongo/s/client/version_manager.cpp index 69a4ab67b5a..a24ef43df52 100644 --- a/src/mongo/s/client/version_manager.cpp +++ b/src/mongo/s/client/version_manager.cpp @@ -36,6 +36,7 @@ #include "mongo/client/dbclient_cursor.h" #include "mongo/client/dbclient_rs.h" #include "mongo/db/namespace_string.h" +#include "mongo/logv2/log.h" #include "mongo/s/catalog_cache.h" #include "mongo/s/client/shard_connection.h" #include "mongo/s/client/shard_registry.h" @@ -202,7 +203,7 @@ bool initShardVersionEmptyNS(OperationContext* opCtx, DBClientBase* conn_in) { true, result); - LOG(3) << "initial sharding result : " << result; + LOGV2_DEBUG(22741, 3, "initial sharding result : {result}", "result"_attr = result); connectionShardStatus.setSequence(conn, "", 0); return ok; @@ -221,8 +222,9 @@ bool initShardVersionEmptyNS(OperationContext* opCtx, DBClientBase* conn_in) { static Occasionally sampler; if (sampler.tick()) { - warning() << "failed to initialize new replica set connection version, " - << "will initialize on first use"; + LOGV2_WARNING(22747, + "failed to initialize new replica set connection version, will " + "initialize on first use"); } return false; @@ -343,11 +345,19 @@ bool checkShardVersion(OperationContext* opCtx, version = manager->getVersion(shard->getId()); } - LOG(1) << "setting shard version of " << version << " for " << ns << " on shard " - << shard->toString(); + LOGV2_DEBUG(22742, + 1, + "setting shard version of {version} for {ns} on shard {shard}", + "version"_attr = version, + "ns"_attr = ns, + "shard"_attr = shard->toString()); - LOG(3) << "last version sent with chunk manager iteration " << sequenceNumber - << ", current chunk manager iteration is " << officialSequenceNumber; + LOGV2_DEBUG(22743, + 3, + "last version sent with chunk manager iteration {sequenceNumber}, current chunk " + "manager iteration is {officialSequenceNumber}", + "sequenceNumber"_attr = sequenceNumber, + "officialSequenceNumber"_attr = officialSequenceNumber); BSONObj result; if (setShardVersion(opCtx, @@ -358,7 +368,7 @@ bool checkShardVersion(OperationContext* opCtx, manager.get(), authoritative, result)) { - LOG(1) << " setShardVersion success: " << result; + LOGV2_DEBUG(22744, 1, " setShardVersion success: {result}", "result"_attr = result); connectionShardStatus.setSequence(conn, ns, officialSequenceNumber); return true; } @@ -367,7 +377,7 @@ bool checkShardVersion(OperationContext* opCtx, int errCode = result["code"].numberInt(); uassert(errCode, result["errmsg"].String(), errCode != ErrorCodes::NoShardingEnabled); - LOG(1) << " setShardVersion failed!\n" << result; + LOGV2_DEBUG(22745, 1, " setShardVersion failed!\n{result}", "result"_attr = result); if (result["need_authoritative"].trueValue()) massert(10428, "need_authoritative set but in authoritative mode already", !authoritative); @@ -394,7 +404,7 @@ bool checkShardVersion(OperationContext* opCtx, string errmsg = str::stream() << "setShardVersion failed shard: " << shard->toString() << " " << result; - log() << " " << errmsg; + LOGV2(22746, " {errmsg}", "errmsg"_attr = errmsg); massert(10429, errmsg, 0); return true; } |