diff options
author | Gabriel Russell <gabriel.russell@mongodb.com> | 2020-02-13 11:49:46 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-02-13 18:16:35 +0000 |
commit | a84c09a19720b73cedb2e8ef7c5cfeedfa1c9761 (patch) | |
tree | 85ac46cd5f4ea6d5134560bf764fb9e6cf11fe4e /src/mongo/db/s/shard_filtering_metadata_refresh.cpp | |
parent | 6df40e01f7b6899affc4536e7e73a35802cabf98 (diff) | |
download | mongo-a84c09a19720b73cedb2e8ef7c5cfeedfa1c9761.tar.gz |
SERVER-45869 automatically converted structured logging
Diffstat (limited to 'src/mongo/db/s/shard_filtering_metadata_refresh.cpp')
-rw-r--r-- | src/mongo/db/s/shard_filtering_metadata_refresh.cpp | 49 |
1 files changed, 36 insertions, 13 deletions
diff --git a/src/mongo/db/s/shard_filtering_metadata_refresh.cpp b/src/mongo/db/s/shard_filtering_metadata_refresh.cpp index 5926ddcb456..ed66137c3d4 100644 --- a/src/mongo/db/s/shard_filtering_metadata_refresh.cpp +++ b/src/mongo/db/s/shard_filtering_metadata_refresh.cpp @@ -42,6 +42,7 @@ #include "mongo/db/s/operation_sharding_state.h" #include "mongo/db/s/sharding_state.h" #include "mongo/db/s/sharding_statistics.h" +#include "mongo/logv2/log.h" #include "mongo/s/catalog_cache.h" #include "mongo/s/grid.h" #include "mongo/util/fail_point.h" @@ -63,8 +64,11 @@ void onShardVersionMismatch(OperationContext* opCtx, invariant(ShardingState::get(opCtx)->canAcceptShardedCommands()); - LOG(2) << "Metadata refresh requested for " << nss.ns() << " at shard version " - << shardVersionReceived; + LOGV2_DEBUG(22061, + 2, + "Metadata refresh requested for {nss_ns} at shard version {shardVersionReceived}", + "nss_ns"_attr = nss.ns(), + "shardVersionReceived"_attr = shardVersionReceived); ShardingStatistics::get(opCtx).countStaleConfigErrors.addAndFetch(1); @@ -134,7 +138,10 @@ Status onShardVersionMismatchNoExcept(OperationContext* opCtx, onShardVersionMismatch(opCtx, nss, shardVersionReceived, forceRefreshFromThisThread); return Status::OK(); } catch (const DBException& ex) { - log() << "Failed to refresh metadata for collection " << nss << causedBy(redact(ex)); + LOGV2(22062, + "Failed to refresh metadata for collection {nss}{causedBy_ex}", + "nss"_attr = nss, + "causedBy_ex"_attr = causedBy(redact(ex))); return ex.toStatus(); } } @@ -179,8 +186,13 @@ ChunkVersion forceShardFilteringMetadataRefresh(OperationContext* opCtx, if (metadata->isSharded() && metadata->getCollVersion().epoch() == cm->getVersion().epoch() && metadata->getCollVersion() >= cm->getVersion()) { - LOG(1) << "Skipping refresh of metadata for " << nss << " " - << metadata->getCollVersion() << " with an older " << cm->getVersion(); + LOGV2_DEBUG(22063, + 1, + "Skipping refresh of metadata for {nss} {metadata_getCollVersion} with " + "an older {cm_getVersion}", + "nss"_attr = nss, + "metadata_getCollVersion"_attr = metadata->getCollVersion(), + "cm_getVersion"_attr = cm->getVersion()); return metadata->getShardVersion(); } } @@ -202,8 +214,13 @@ ChunkVersion forceShardFilteringMetadataRefresh(OperationContext* opCtx, if (metadata->isSharded() && metadata->getCollVersion().epoch() == cm->getVersion().epoch() && metadata->getCollVersion() >= cm->getVersion()) { - LOG(1) << "Skipping refresh of metadata for " << nss << " " - << metadata->getCollVersion() << " with an older " << cm->getVersion(); + LOGV2_DEBUG(22064, + 1, + "Skipping refresh of metadata for {nss} {metadata_getCollVersion} with " + "an older {cm_getVersion}", + "nss"_attr = nss, + "metadata_getCollVersion"_attr = metadata->getCollVersion(), + "cm_getVersion"_attr = cm->getVersion()); return metadata->getShardVersion(); } } @@ -225,8 +242,10 @@ Status onDbVersionMismatchNoExcept( onDbVersionMismatch(opCtx, dbName, clientDbVersion, serverDbVersion); return Status::OK(); } catch (const DBException& ex) { - log() << "Failed to refresh databaseVersion for database " << dbName - << causedBy(redact(ex)); + LOGV2(22065, + "Failed to refresh databaseVersion for database {dbName}{causedBy_ex}", + "dbName"_attr = dbName, + "causedBy_ex"_attr = causedBy(redact(ex))); return ex.toStatus(); } } @@ -266,10 +285,14 @@ void forceDatabaseRefresh(OperationContext* opCtx, const StringData dbName) { const auto cachedDbVersion = dss->getDbVersion(opCtx, dssLock); if (cachedDbVersion && cachedDbVersion->getUuid() == refreshedDbVersion.getUuid() && cachedDbVersion->getLastMod() >= refreshedDbVersion.getLastMod()) { - LOG(2) << "Skipping setting cached databaseVersion for " << dbName - << " to refreshed version " << refreshedDbVersion.toBSON() - << " because current cached databaseVersion is already " - << cachedDbVersion->toBSON(); + LOGV2_DEBUG(22066, + 2, + "Skipping setting cached databaseVersion for {dbName} to refreshed version " + "{refreshedDbVersion} because current cached databaseVersion is already " + "{cachedDbVersion}", + "dbName"_attr = dbName, + "refreshedDbVersion"_attr = refreshedDbVersion.toBSON(), + "cachedDbVersion"_attr = cachedDbVersion->toBSON()); return; } } |