summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanika Phanse <sanika.phanse@mongodb.com>2021-11-08 15:24:45 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-11-08 16:23:27 +0000
commit9a43c0a3d22c535e916ebe3b208ea86a4b3ce4de (patch)
tree785416da8f2aa9b647461ebd30ce1226de6451e5
parent0f82e6b5941a5b8e0b4a00c0e5b6b852fe201ca3 (diff)
downloadmongo-9a43c0a3d22c535e916ebe3b208ea86a4b3ce4de.tar.gz
SERVER-57680 Use namespace instead of nss for naming log attributes
-rw-r--r--jstests/noPassthrough/graphlookup_sharded_view.js7
-rw-r--r--jstests/sharding/query/lookup_unionWith_subpipeline_local_read.js4
-rw-r--r--jstests/sharding/query/sharded_lookup_execution.js6
-rw-r--r--src/mongo/db/catalog/collection_catalog.cpp11
-rw-r--r--src/mongo/db/catalog/collection_impl.cpp22
-rw-r--r--src/mongo/db/cloner.cpp6
-rw-r--r--src/mongo/db/concurrency/deferred_writer.cpp10
-rw-r--r--src/mongo/db/concurrency/write_conflict_exception.cpp2
-rw-r--r--src/mongo/db/pipeline/document_source_graph_lookup.cpp15
-rw-r--r--src/mongo/db/pipeline/document_source_lookup.cpp8
-rw-r--r--src/mongo/db/pipeline/document_source_union_with.cpp4
-rw-r--r--src/mongo/db/pipeline/sharded_agg_helpers.cpp2
-rw-r--r--src/mongo/db/repl/collection_cloner.cpp2
-rw-r--r--src/mongo/db/repl/initial_syncer_test.cpp2
-rw-r--r--src/mongo/db/repl/oplog.cpp4
-rw-r--r--src/mongo/db/repl/primary_only_service.cpp31
-rw-r--r--src/mongo/db/repl/tenant_collection_cloner.cpp2
-rw-r--r--src/mongo/db/repl/tenant_oplog_applier.cpp6
-rw-r--r--src/mongo/db/s/active_migrations_registry.cpp6
-rw-r--r--src/mongo/db/s/balancer/balancer.cpp2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager.cpp4
-rw-r--r--src/mongo/db/s/migration_destination_manager.cpp4
-rw-r--r--src/mongo/db/s/migration_util.cpp2
-rw-r--r--src/mongo/db/s/shard_local.cpp2
-rw-r--r--src/mongo/db/s/split_chunk.cpp4
-rw-r--r--src/mongo/db/storage/devnull/ephemeral_catalog_record_store.cpp18
-rw-r--r--src/mongo/db/storage/durable_catalog_impl.cpp7
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp4
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp3
29 files changed, 105 insertions, 95 deletions
diff --git a/jstests/noPassthrough/graphlookup_sharded_view.js b/jstests/noPassthrough/graphlookup_sharded_view.js
index 9bc01cc482b..82242f690f8 100644
--- a/jstests/noPassthrough/graphlookup_sharded_view.js
+++ b/jstests/noPassthrough/graphlookup_sharded_view.js
@@ -79,8 +79,11 @@ function getMatchingLogsForTestRun(logs, fields) {
function getShardedViewExceptions(shard) {
const shardLog = assert.commandWorked(sharded[shard].adminCommand({getLog: "global"})).log;
- return ["test.docs", "test.subjects"].map(ns => {
- return {ns: ns, count: [...getMatchingLogsForTestRun(shardLog, {id: 5865400, ns})].length};
+ return ["test.docs", "test.subjects"].map(namespace => {
+ return {
+ ns: namespace,
+ count: [...getMatchingLogsForTestRun(shardLog, {id: 5865400, namespace})].length
+ };
});
}
diff --git a/jstests/sharding/query/lookup_unionWith_subpipeline_local_read.js b/jstests/sharding/query/lookup_unionWith_subpipeline_local_read.js
index 119e6c028f8..2da51eb3ca6 100644
--- a/jstests/sharding/query/lookup_unionWith_subpipeline_local_read.js
+++ b/jstests/sharding/query/lookup_unionWith_subpipeline_local_read.js
@@ -75,7 +75,9 @@ function getLocalReadCount(node, foreignNs, comment) {
const log = assert.commandWorked(node.adminCommand({getLog: "global"})).log;
const countMatchingLogs =
- ns => [...findMatchingLogLines(log, {id: 5837600, ns, comment: {comment: comment}})].length;
+ namespace => [...findMatchingLogLines(
+ log, {id: 5837600, namespace, comment: {comment: comment}})]
+ .length;
// Query the logs for local reads against the namespace specified in the top-level stage and the
// 'foreign' namespace. The latter case catches reads when the original namespace was a view.
diff --git a/jstests/sharding/query/sharded_lookup_execution.js b/jstests/sharding/query/sharded_lookup_execution.js
index 3bef0c45556..7ffc854be78 100644
--- a/jstests/sharding/query/sharded_lookup_execution.js
+++ b/jstests/sharding/query/sharded_lookup_execution.js
@@ -46,9 +46,11 @@ const updatesColl = mongosDB.updates;
const freshMongos = st.s1;
const freshReviews = freshMongos.getDB(testName)[reviewsColl.getName()];
-function getLocalReadCount(node, ns, comment) {
+function getLocalReadCount(node, namespace, comment) {
const log = assert.commandWorked(node.adminCommand({getLog: "global"})).log;
- return [...findMatchingLogLines(log, {id: 5837600, ns, comment: {comment: comment}})].length;
+ return [
+ ...findMatchingLogLines(log, {id: 5837600, namespace, comment: {comment: comment}})
+ ].length;
}
function assertLookupExecution(pipeline, opts, expected) {
diff --git a/src/mongo/db/catalog/collection_catalog.cpp b/src/mongo/db/catalog/collection_catalog.cpp
index d5d3c4da850..f1a1097548f 100644
--- a/src/mongo/db/catalog/collection_catalog.cpp
+++ b/src/mongo/db/catalog/collection_catalog.cpp
@@ -971,9 +971,9 @@ void CollectionCatalog::registerCollection(OperationContext* opCtx,
LOGV2_DEBUG(20280,
1,
- "Registering collection {ns} with UUID {uuid}",
+ "Registering collection {namespace} with UUID {uuid}",
"Registering collection",
- "namespace"_attr = ns,
+ logAttrs(ns),
"uuid"_attr = uuid);
auto dbName = ns.db().toString();
@@ -1014,7 +1014,7 @@ std::shared_ptr<Collection> CollectionCatalog::deregisterCollection(OperationCon
auto dbName = ns.db().toString();
auto dbIdPair = std::make_pair(dbName, uuid);
- LOGV2_DEBUG(20281, 1, "Deregistering collection", "namespace"_attr = ns, "uuid"_attr = uuid);
+ LOGV2_DEBUG(20281, 1, "Deregistering collection", logAttrs(ns), "uuid"_attr = uuid);
// Make sure collection object exists.
invariant(_collections.find(ns) != _collections.end());
@@ -1051,8 +1051,7 @@ void CollectionCatalog::deregisterAllCollectionsAndViews() {
auto dbName = ns.db().toString();
auto dbIdPair = std::make_pair(dbName, uuid);
- LOGV2_DEBUG(
- 20283, 1, "Deregistering collection", "namespace"_attr = ns, "uuid"_attr = uuid);
+ LOGV2_DEBUG(20283, 1, "Deregistering collection", logAttrs(ns), "uuid"_attr = uuid);
entry.second.reset();
}
@@ -1068,7 +1067,7 @@ void CollectionCatalog::deregisterAllCollectionsAndViews() {
void CollectionCatalog::registerView(const NamespaceString& ns) {
if (_collections.contains(ns)) {
- LOGV2(5706100, "Conflicted creating a view", "ns"_attr = ns);
+ LOGV2(5706100, "Conflicted creating a view", logAttrs(ns));
throw WriteConflictException();
}
diff --git a/src/mongo/db/catalog/collection_impl.cpp b/src/mongo/db/catalog/collection_impl.cpp
index 1fd71ad9596..ca745f9f62e 100644
--- a/src/mongo/db/catalog/collection_impl.cpp
+++ b/src/mongo/db/catalog/collection_impl.cpp
@@ -163,10 +163,10 @@ std::unique_ptr<CollatorInterface> parseCollation(OperationContext* opCtx,
// be possible, so these are an invariant rather than fassert.
if (collator == ErrorCodes::IncompatibleCollationVersion) {
LOGV2(20288,
- "Collection {nss} has a default collation which is incompatible with this version: "
- "{collationSpec}",
+ "Collection {namespace} has a default collation which is incompatible with this "
+ "version: {collationSpec}"
"Collection has a default collation incompatible with this version",
- "namespace"_attr = nss,
+ logAttrs(nss),
"collationSpec"_attr = collationSpec);
fassertFailedNoTrace(40144);
}
@@ -483,9 +483,9 @@ void CollectionImpl::init(OperationContext* opCtx) {
// Log an error and startup warning if the collection validator is malformed.
LOGV2_WARNING_OPTIONS(20293,
{logv2::LogTag::kStartupWarnings},
- "Collection {ns} has malformed validator: {validatorStatus}",
+ "Collection {namespace} has malformed validator: {validatorStatus}",
"Collection has malformed validator",
- "namespace"_attr = _ns,
+ logAttrs(_ns),
"validatorStatus"_attr = _validator.getStatus());
}
@@ -626,7 +626,7 @@ Status CollectionImpl::checkValidation(OperationContext* opCtx, const BSONObj& d
ValidationActionEnum::warn) {
LOGV2_WARNING(20294,
"Document would fail validation",
- "namespace"_attr = ns(),
+ logAttrs(ns()),
"document"_attr = redact(document),
"errInfo"_attr = generatedError);
return Status::OK();
@@ -765,7 +765,7 @@ Status CollectionImpl::insertDocuments(OperationContext* opCtx,
LOGV2(20289,
"hangAfterCollectionInserts fail point enabled. Blocking "
"until fail point is disabled.",
- "namespace"_attr = _ns,
+ logAttrs(_ns),
"whenFirst"_attr = whenFirst);
hangAfterCollectionInserts.pauseWhileSet(opCtx);
},
@@ -827,7 +827,7 @@ Status CollectionImpl::insertDocumentForBulkLoader(
LOGV2(20290,
"Failpoint failAfterBulkLoadDocInsert enabled. Throwing "
"WriteConflictException",
- "namespace"_attr = _ns);
+ logAttrs(_ns));
throw WriteConflictException();
}
@@ -1162,7 +1162,7 @@ void CollectionImpl::deleteDocument(OperationContext* opCtx,
if (isCapped() && !isClustered() && opCtx->isEnforcingConstraints()) {
// System operations such as tenant migration, secondary batch application or TTL on a
// capped clustered collection can delete from capped collections.
- LOGV2(20291, "failing remove on a capped ns", "namespace"_attr = _ns);
+ LOGV2(20291, "failing remove on a capped ns", logAttrs(_ns));
uasserted(10089, "cannot remove from a capped collection");
}
@@ -1530,9 +1530,9 @@ bool CollectionImpl::isEmpty(OperationContext* opCtx) const {
LOGV2_DEBUG(20292,
2,
- "Detected erroneous fast count for collection {ns}({uuid}) "
+ "Detected erroneous fast count for collection {namespace}({uuid}) "
"[{getRecordStore_getIdent}]. Record count reported by: {bob_obj}",
- "ns"_attr = ns(),
+ logAttrs(ns()),
"uuid"_attr = uuid(),
"getRecordStore_getIdent"_attr = getRecordStore()->getIdent(),
"bob_obj"_attr = bob.obj());
diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp
index 41d4ae540b3..935737225ba 100644
--- a/src/mongo/db/cloner.cpp
+++ b/src/mongo/db/cloner.cpp
@@ -238,7 +238,7 @@ void Cloner::_copy(OperationContext* opCtx,
LOGV2_DEBUG(20414,
2,
"\t\tcloning collection",
- "ns"_attr = nss,
+ logAttrs(nss),
"conn_getServerAddress"_attr = conn->getServerAddress());
Fun f(opCtx, toDBName);
@@ -276,7 +276,7 @@ void Cloner::_copyIndexes(OperationContext* opCtx,
LOGV2_DEBUG(20415,
2,
"\t\t copyIndexes",
- "ns"_attr = nss,
+ logAttrs(nss),
"conn_getServerAddress"_attr = conn->getServerAddress());
uassert(ErrorCodes::PrimarySteppedDown,
@@ -574,7 +574,7 @@ Status Cloner::copyDb(OperationContext* opCtx,
clonedColls->insert(nss.ns());
- LOGV2_DEBUG(20421, 1, "\t\t cloning", "ns"_attr = nss, "host"_attr = masterHost);
+ LOGV2_DEBUG(20421, 1, "\t\t cloning", logAttrs(nss), "host"_attr = masterHost);
_copy(opCtx,
dBName,
diff --git a/src/mongo/db/concurrency/deferred_writer.cpp b/src/mongo/db/concurrency/deferred_writer.cpp
index 6c0f0ed3c77..de3895f9d2e 100644
--- a/src/mongo/db/concurrency/deferred_writer.cpp
+++ b/src/mongo/db/concurrency/deferred_writer.cpp
@@ -59,11 +59,11 @@ void DeferredWriter::_logFailure(const Status& status) {
void DeferredWriter::_logDroppedEntry() {
_droppedEntries += 1;
if (TimePoint::clock::now() - _lastLoggedDrop > kLogInterval) {
- LOGV2(
- 20517,
- "Deferred write buffer for {nss} is full. {droppedEntries} entries have been dropped.",
- "nss"_attr = _nss.toString(),
- "droppedEntries"_attr = _droppedEntries);
+ LOGV2(20517,
+ "Deferred write buffer for {namespace} is full. {droppedEntries} entries have been "
+ "dropped.",
+ logAttrs(_nss),
+ "droppedEntries"_attr = _droppedEntries);
_lastLoggedDrop = stdx::chrono::system_clock::now();
_droppedEntries = 0;
}
diff --git a/src/mongo/db/concurrency/write_conflict_exception.cpp b/src/mongo/db/concurrency/write_conflict_exception.cpp
index ea8ce3c75c9..f57ed9282bc 100644
--- a/src/mongo/db/concurrency/write_conflict_exception.cpp
+++ b/src/mongo/db/concurrency/write_conflict_exception.cpp
@@ -63,6 +63,6 @@ void WriteConflictException::logAndBackoff(int attempt, StringData operation, St
static_cast<size_t>(attempt),
"Caught WriteConflictException",
"operation"_attr = operation,
- "ns"_attr = ns);
+ logAttrs(NamespaceString(ns)));
}
} // namespace mongo
diff --git a/src/mongo/db/pipeline/document_source_graph_lookup.cpp b/src/mongo/db/pipeline/document_source_graph_lookup.cpp
index c126ea0977e..331e8fdd444 100644
--- a/src/mongo/db/pipeline/document_source_graph_lookup.cpp
+++ b/src/mongo/db/pipeline/document_source_graph_lookup.cpp
@@ -295,13 +295,14 @@ void DocumentSourceGraphLookUp::doBreadthFirstSearch() {
_fromExpCtx = _fromExpCtx->copyWith(e->getNamespace());
_fromExpCtx->addResolvedNamespaces(liteParsedPipeline.getInvolvedNamespaces());
- LOGV2_DEBUG(5865400,
- 3,
- "$graphLookup found view definition. ns: {ns}, pipeline: {pipeline}. "
- "New $graphLookup sub-pipeline: {new_pipe}",
- "ns"_attr = e->getNamespace(),
- "pipeline"_attr = Value(e->getPipeline()),
- "new_pipe"_attr = _fromPipeline);
+ LOGV2_DEBUG(
+ 5865400,
+ 3,
+ "$graphLookup found view definition. ns: {namespace}, pipeline: {pipeline}. "
+ "New $graphLookup sub-pipeline: {new_pipe}",
+ logAttrs(e->getNamespace()),
+ "pipeline"_attr = Value(e->getPipeline()),
+ "new_pipe"_attr = _fromPipeline);
// We can now safely optimize and reattempt attaching the cursor source.
pipeline = Pipeline::makePipeline(_fromPipeline, _fromExpCtx, pipelineOpts);
diff --git a/src/mongo/db/pipeline/document_source_lookup.cpp b/src/mongo/db/pipeline/document_source_lookup.cpp
index 4edce8a721b..f4c84b620ad 100644
--- a/src/mongo/db/pipeline/document_source_lookup.cpp
+++ b/src/mongo/db/pipeline/document_source_lookup.cpp
@@ -555,9 +555,9 @@ std::unique_ptr<Pipeline, PipelineDeleter> DocumentSourceLookUp::buildPipeline(
LOGV2_DEBUG(3254800,
3,
- "$lookup found view definition. ns: {ns}, pipeline: {pipeline}. New "
+ "$lookup found view definition. ns: {namespace}, pipeline: {pipeline}. New "
"$lookup sub-pipeline: {new_pipe}",
- "ns"_attr = e->getNamespace(),
+ logAttrs(e->getNamespace()),
"pipeline"_attr = Value(e->getPipeline()),
"new_pipe"_attr = _resolvedPipeline);
@@ -605,9 +605,9 @@ std::unique_ptr<Pipeline, PipelineDeleter> DocumentSourceLookUp::buildPipeline(
LOGV2_DEBUG(3254801,
3,
- "$lookup found view definition. ns: {ns}, pipeline: {pipeline}. New "
+ "$lookup found view definition. ns: {namespace}, pipeline: {pipeline}. New "
"$lookup sub-pipeline: {new_pipe}",
- "ns"_attr = e->getNamespace(),
+ logAttrs(e->getNamespace()),
"pipeline"_attr = Value(e->getPipeline()),
"new_pipe"_attr = _resolvedPipeline);
diff --git a/src/mongo/db/pipeline/document_source_union_with.cpp b/src/mongo/db/pipeline/document_source_union_with.cpp
index 2ddb448b641..48eb2ed332a 100644
--- a/src/mongo/db/pipeline/document_source_union_with.cpp
+++ b/src/mongo/db/pipeline/document_source_union_with.cpp
@@ -272,9 +272,9 @@ MONGO_COMPILER_NOINLINE void DocumentSourceUnionWith::logShardedViewFound(
const ExceptionFor<ErrorCodes::CommandOnShardedViewNotSupportedOnMongod>& e) {
LOGV2_DEBUG(4556300,
3,
- "$unionWith found view definition. ns: {ns}, pipeline: {pipeline}. New "
+ "$unionWith found view definition. ns: {namespace}, pipeline: {pipeline}. New "
"$unionWith sub-pipeline: {new_pipe}",
- "ns"_attr = e->getNamespace(),
+ logAttrs(e->getNamespace()),
"pipeline"_attr = Value(e->getPipeline()),
"new_pipe"_attr = _pipeline->serializeToBson());
}
diff --git a/src/mongo/db/pipeline/sharded_agg_helpers.cpp b/src/mongo/db/pipeline/sharded_agg_helpers.cpp
index 3e268b59067..dea8c3a5745 100644
--- a/src/mongo/db/pipeline/sharded_agg_helpers.cpp
+++ b/src/mongo/db/pipeline/sharded_agg_helpers.cpp
@@ -1344,7 +1344,7 @@ std::unique_ptr<Pipeline, PipelineDeleter> attachCursorToPipeline(
LOGV2_DEBUG(5837600,
3,
"Performing local read",
- "ns"_attr = expCtx->ns,
+ logAttrs(expCtx->ns),
"pipeline"_attr = pipelineToTarget->serializeToBson(),
"comment"_attr = expCtx->opCtx->getComment());
diff --git a/src/mongo/db/repl/collection_cloner.cpp b/src/mongo/db/repl/collection_cloner.cpp
index c25fe001a6e..810876155b4 100644
--- a/src/mongo/db/repl/collection_cloner.cpp
+++ b/src/mongo/db/repl/collection_cloner.cpp
@@ -135,7 +135,7 @@ void CollectionCloner::preStage() {
1,
"Skipping the recording of some initial sync metrics due to failure in the "
"'collStats' command",
- "ns"_attr = _sourceNss.coll().toString(),
+ logAttrs(_sourceNss),
"status"_attr = status);
}
}
diff --git a/src/mongo/db/repl/initial_syncer_test.cpp b/src/mongo/db/repl/initial_syncer_test.cpp
index e12d15692e1..8d304ba1ebf 100644
--- a/src/mongo/db/repl/initial_syncer_test.cpp
+++ b/src/mongo/db/repl/initial_syncer_test.cpp
@@ -342,7 +342,7 @@ protected:
if (collInfo->stats->initCalled) {
LOGV2(24165,
"reusing collection during test which may cause problems",
- "nss"_attr = nss);
+ logAttrs(nss));
}
auto localLoader = std::make_unique<CollectionBulkLoaderMock>(collInfo->stats);
auto status = localLoader->init(secondaryIndexSpecs);
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp
index 2198052beeb..7f612d4865d 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -160,7 +160,7 @@ void applyImportCollectionDefault(OperationContext* opCtx,
"Applying importCollection is not supported with MongoDB Community "
"Edition, please use MongoDB Enterprise Edition",
"importUUID"_attr = importUUID,
- "nss"_attr = nss,
+ logAttrs(nss),
"numRecords"_attr = numRecords,
"dataSize"_attr = dataSize,
"catalogEntry"_attr = redact(catalogEntry),
@@ -226,7 +226,7 @@ void createIndexForApplyOps(OperationContext* opCtx,
if (ErrorCodes::IndexBuildAlreadyInProgress == prepareSpecResult) {
LOGV2(4924900,
"Index build: already in progress during initial sync",
- "ns"_attr = indexNss,
+ logAttrs(indexNss),
"uuid"_attr = indexCollection->uuid(),
"spec"_attr = indexSpec);
return;
diff --git a/src/mongo/db/repl/primary_only_service.cpp b/src/mongo/db/repl/primary_only_service.cpp
index a43658e8926..d924c7246e4 100644
--- a/src/mongo/db/repl/primary_only_service.cpp
+++ b/src/mongo/db/repl/primary_only_service.cpp
@@ -153,12 +153,12 @@ void PrimaryOnlyServiceRegistry::registerService(std::unique_ptr<PrimaryOnlyServ
<< ") with state document namespace \"" << ns
<< "\" that is already in use by service "
<< existingService->getServiceName());
- LOGV2_INFO(
- 5123008,
- "Successfully registered PrimaryOnlyService {service} with state documents stored in {ns}",
- "Successfully registered PrimaryOnlyService",
- "service"_attr = name,
- "ns"_attr = ns);
+ LOGV2_INFO(5123008,
+ "Successfully registered PrimaryOnlyService {service} with state documents stored "
+ "in {namespace}",
+ "Successfully registered PrimaryOnlyService",
+ "service"_attr = name,
+ logAttrs(ns));
}
PrimaryOnlyService* PrimaryOnlyServiceRegistry::lookupServiceByName(StringData serviceName) {
@@ -644,13 +644,14 @@ void PrimaryOnlyService::_rebuildInstances(long long term) noexcept {
if (!MONGO_unlikely(PrimaryOnlyServiceSkipRebuildingInstances.shouldFail())) {
auto ns = getStateDocumentsNS();
- LOGV2_DEBUG(5123004,
- 2,
- "Querying {ns} to look for state documents while rebuilding PrimaryOnlyService "
- "{service}",
- "Querying to look for state documents while rebuilding PrimaryOnlyService",
- "ns"_attr = ns,
- "service"_attr = serviceName);
+ LOGV2_DEBUG(
+ 5123004,
+ 2,
+ "Querying {namespace} to look for state documents while rebuilding PrimaryOnlyService "
+ "{service}",
+ "Querying to look for state documents while rebuilding PrimaryOnlyService",
+ logAttrs(ns),
+ "service"_attr = serviceName);
// The PrimaryOnlyServiceClientObserver will make any OpCtx created as part of a
// PrimaryOnlyService immediately get interrupted if the service is not in state kRunning.
@@ -673,11 +674,11 @@ void PrimaryOnlyService::_rebuildInstances(long long term) noexcept {
} catch (const DBException& e) {
LOGV2_ERROR(
4923601,
- "Failed to start PrimaryOnlyService {service} because the query on {ns} "
+ "Failed to start PrimaryOnlyService {service} because the query on {namespace} "
"for state documents failed due to {error}",
"Failed to start PrimaryOnlyService because the query for state documents failed",
"service"_attr = serviceName,
- "ns"_attr = ns,
+ logAttrs(ns),
"error"_attr = e);
Status status = e.toStatus();
diff --git a/src/mongo/db/repl/tenant_collection_cloner.cpp b/src/mongo/db/repl/tenant_collection_cloner.cpp
index 75827e5f6b3..35a99338271 100644
--- a/src/mongo/db/repl/tenant_collection_cloner.cpp
+++ b/src/mongo/db/repl/tenant_collection_cloner.cpp
@@ -184,7 +184,7 @@ BaseCloner::AfterStageBehavior TenantCollectionCloner::countStage() {
LOGV2_WARNING(5426601,
"Skipping recording of data size metrics for collection due to failure in the"
" 'collStats' command, tenant migration stats may be inaccurate.",
- "nss"_attr = _sourceNss,
+ logAttrs(_sourceNss),
"migrationId"_attr = getSharedData()->getMigrationId(),
"tenantId"_attr = _tenantId,
"status"_attr = status);
diff --git a/src/mongo/db/repl/tenant_oplog_applier.cpp b/src/mongo/db/repl/tenant_oplog_applier.cpp
index 60c6c1a63ed..794cb4e58db 100644
--- a/src/mongo/db/repl/tenant_oplog_applier.cpp
+++ b/src/mongo/db/repl/tenant_oplog_applier.cpp
@@ -346,7 +346,7 @@ void TenantOplogApplier::_checkNsAndUuidsBelongToTenant(OperationContext* opCtx,
"Namespace does not belong to tenant being migrated",
"tenant"_attr = _tenantId,
"migrationUuid"_attr = _migrationUuid,
- "nss"_attr = op.getNss());
+ logAttrs(op.getNss()));
uasserted(4886016, "Namespace does not belong to tenant being migrated");
}
if (!op.getUuid())
@@ -361,7 +361,7 @@ void TenantOplogApplier::_checkNsAndUuidsBelongToTenant(OperationContext* opCtx,
"tenant"_attr = _tenantId,
"migrationUuid"_attr = _migrationUuid,
"UUID"_attr = *op.getUuid(),
- "nss"_attr = nss.ns());
+ logAttrs(nss));
uasserted(4886014, "UUID does not belong to tenant being migrated");
}
_knownGoodUuids.insert(*op.getUuid());
@@ -372,7 +372,7 @@ void TenantOplogApplier::_checkNsAndUuidsBelongToTenant(OperationContext* opCtx,
"tenant"_attr = _tenantId,
"migrationUuid"_attr = _migrationUuid,
"UUID"_attr = *op.getUuid(),
- "nss"_attr = op.getNss().ns());
+ logAttrs(op.getNss()));
}
};
diff --git a/src/mongo/db/s/active_migrations_registry.cpp b/src/mongo/db/s/active_migrations_registry.cpp
index 500d30bf102..d27d87554c3 100644
--- a/src/mongo/db/s/active_migrations_registry.cpp
+++ b/src/mongo/db/s/active_migrations_registry.cpp
@@ -105,7 +105,7 @@ StatusWith<ScopedDonateChunk> ActiveMigrationsRegistry::registerDonateChunk(
"registerDonateChunk ",
"keys"_attr = ChunkRange(args.getMinKey(), args.getMaxKey()).toString(),
"toShardId"_attr = args.getToShardId(),
- "ns"_attr = args.getNss().ns());
+ logAttrs(args.getNss()));
return {ScopedDonateChunk(nullptr, false, _activeMoveChunkState->notification)};
}
@@ -117,7 +117,7 @@ StatusWith<ScopedDonateChunk> ActiveMigrationsRegistry::registerDonateChunk(
"currentToShardId"_attr = _activeMoveChunkState->args.getToShardId(),
"newKeys"_attr = ChunkRange(args.getMinKey(), args.getMaxKey()).toString(),
"newToShardId"_attr = args.getToShardId(),
- "ns"_attr = args.getNss().ns());
+ logAttrs(args.getNss()));
return _activeMoveChunkState->constructErrorStatus();
}
@@ -148,7 +148,7 @@ StatusWith<ScopedReceiveChunk> ActiveMigrationsRegistry::registerReceiveChunk(
_activeMoveChunkState->args.getMaxKey())
.toString(),
"currentToShardId"_attr = _activeMoveChunkState->args.getToShardId(),
- "ns"_attr = _activeMoveChunkState->args.getNss().ns());
+ logAttrs(_activeMoveChunkState->args.getNss()));
return _activeMoveChunkState->constructErrorStatus();
}
diff --git a/src/mongo/db/s/balancer/balancer.cpp b/src/mongo/db/s/balancer/balancer.cpp
index cdd27339a84..6f99595d70c 100644
--- a/src/mongo/db/s/balancer/balancer.cpp
+++ b/src/mongo/db/s/balancer/balancer.cpp
@@ -798,7 +798,7 @@ void Balancer::_mergeChunksIfNeeded(OperationContext* opCtx) {
continue;
}
- LOGV2(8423321, "Move chunk phase on {nss}", "nss"_attr = coll.getNss());
+ LOGV2(8423321, "Move chunk phase on {namespace}", logAttrs(coll.getNss()));
progress = _chunkMerger->moveMergeOrSplitChunks(opCtx, coll);
if (progress != Progress::Done) {
diff --git a/src/mongo/db/s/config/sharding_catalog_manager.cpp b/src/mongo/db/s/config/sharding_catalog_manager.cpp
index c3bdca61a81..33679a7786f 100644
--- a/src/mongo/db/s/config/sharding_catalog_manager.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager.cpp
@@ -623,7 +623,7 @@ void ShardingCatalogManager::_enableSupportForLongCollectionName(OperationContex
} catch (const ExceptionFor<ErrorCodes::ConflictingOperationInProgress>& e) {
LOGV2_ERROR(5857400,
"Failed to refresh collection on shards after enabling long name support",
- "nss"_attr = collNss.ns(),
+ logAttrs(collNss),
"error"_attr = redact(e));
}
}
@@ -673,7 +673,7 @@ void ShardingCatalogManager::_disableSupportForLongCollectionName(OperationConte
} catch (const ExceptionFor<ErrorCodes::ConflictingOperationInProgress>& e) {
LOGV2_ERROR(5857401,
"Failed to refresh collection on shards after disabling long name support",
- "nss"_attr = collNss.ns(),
+ logAttrs(collNss),
"error"_attr = redact(e));
}
}
diff --git a/src/mongo/db/s/migration_destination_manager.cpp b/src/mongo/db/s/migration_destination_manager.cpp
index e51b7f8bf29..7cc860c7d02 100644
--- a/src/mongo/db/s/migration_destination_manager.cpp
+++ b/src/mongo/db/s/migration_destination_manager.cpp
@@ -1568,7 +1568,7 @@ void MigrationDestinationManager::_migrateDriver(OperationContext* outerOpCtx,
->acquireRecoverableCriticalSectionBlockWrites(
opCtx, _nss, critSecReason, ShardingCatalogClient::kLocalWriteConcern);
- LOGV2(5899114, "Entered migration recipient critical section", "nss"_attr = _nss);
+ LOGV2(5899114, "Entered migration recipient critical section", logAttrs(_nss));
timeInCriticalSection.emplace();
});
@@ -1801,7 +1801,7 @@ void MigrationDestinationManager::awaitCriticalSectionReleaseSignalAndCompleteMi
LOGV2(5899108,
"Exited migration recipient critical section",
- "nss"_attr = _nss,
+ logAttrs(_nss),
"durationMillis"_attr = timeInCriticalSectionMs);
// Wait for the updates to the catalog cache to be written to disk before removing the
diff --git a/src/mongo/db/s/migration_util.cpp b/src/mongo/db/s/migration_util.cpp
index 9a7c686a5a3..a8dfbbbe235 100644
--- a/src/mongo/db/s/migration_util.cpp
+++ b/src/mongo/db/s/migration_util.cpp
@@ -441,7 +441,7 @@ ExecutorFuture<void> submitRangeDeletionTask(OperationContext* opCtx,
LOGV2(55557,
"cleanUpRange failed due to keyPattern shorter than range "
"deletion bounds. Refreshing collection metadata to retry.",
- "nss"_attr = deletionTask.getNss(),
+ logAttrs(deletionTask.getNss()),
"status"_attr = redact(status));
onShardVersionMismatch(
diff --git a/src/mongo/db/s/shard_local.cpp b/src/mongo/db/s/shard_local.cpp
index aad3d286b07..ee7d9bada11 100644
--- a/src/mongo/db/s/shard_local.cpp
+++ b/src/mongo/db/s/shard_local.cpp
@@ -183,7 +183,7 @@ Status ShardLocal::createIndexOnConfig(OperationContext* opCtx,
const auto& indexSpec = indexSpecs[0];
LOGV2(5173300,
"Creating index on sharding collection with existing data",
- "ns"_attr = ns,
+ logAttrs(ns),
"uuid"_attr = collection->uuid(),
"index"_attr = indexSpec);
auto indexConstraints = IndexBuildsManager::IndexConstraints::kEnforce;
diff --git a/src/mongo/db/s/split_chunk.cpp b/src/mongo/db/s/split_chunk.cpp
index 3f6f3a63029..5f4d1156a64 100644
--- a/src/mongo/db/s/split_chunk.cpp
+++ b/src/mongo/db/s/split_chunk.cpp
@@ -217,8 +217,8 @@ StatusWith<boost::optional<ChunkRange>> splitChunk(OperationContext* opCtx,
if (!collection) {
LOGV2_WARNING(
23778,
- "will not perform top-chunk checking since {nss} does not exist after splitting",
- "nss"_attr = nss.toString());
+ "will not perform top-chunk checking since {namespace} does not exist after splitting",
+ logAttrs(nss));
return boost::optional<ChunkRange>(boost::none);
}
diff --git a/src/mongo/db/storage/devnull/ephemeral_catalog_record_store.cpp b/src/mongo/db/storage/devnull/ephemeral_catalog_record_store.cpp
index 52832eb14f7..cf6deca4517 100644
--- a/src/mongo/db/storage/devnull/ephemeral_catalog_record_store.cpp
+++ b/src/mongo/db/storage/devnull/ephemeral_catalog_record_store.cpp
@@ -303,10 +303,11 @@ const EphemeralForTestRecordStore::EphemeralForTestRecord* EphemeralForTestRecor
WithLock, const RecordId& loc) const {
Records::const_iterator it = _data->records.find(loc);
if (it == _data->records.end()) {
- LOGV2_ERROR(23720,
- "EphemeralForTestRecordStore::recordFor cannot find record for {ns}:{loc}",
- "ns"_attr = ns(),
- "loc"_attr = loc);
+ LOGV2_ERROR(
+ 23720,
+ "EphemeralForTestRecordStore::recordFor cannot find record for {namespace}:{loc}",
+ logAttrs(NamespaceString(ns())),
+ "loc"_attr = loc);
}
invariant(it != _data->records.end());
return &it->second;
@@ -316,10 +317,11 @@ EphemeralForTestRecordStore::EphemeralForTestRecord* EphemeralForTestRecordStore
WithLock, const RecordId& loc) {
Records::iterator it = _data->records.find(loc);
if (it == _data->records.end()) {
- LOGV2_ERROR(23721,
- "EphemeralForTestRecordStore::recordFor cannot find record for {ns}:{loc}",
- "ns"_attr = ns(),
- "loc"_attr = loc);
+ LOGV2_ERROR(
+ 23721,
+ "EphemeralForTestRecordStore::recordFor cannot find record for {namespace}:{loc}",
+ logAttrs(NamespaceString(ns())),
+ "loc"_attr = loc);
}
invariant(it != _data->records.end());
return &it->second;
diff --git a/src/mongo/db/storage/durable_catalog_impl.cpp b/src/mongo/db/storage/durable_catalog_impl.cpp
index 61f84a8c34f..ecbb34b7dbd 100644
--- a/src/mongo/db/storage/durable_catalog_impl.cpp
+++ b/src/mongo/db/storage/durable_catalog_impl.cpp
@@ -418,8 +418,7 @@ StatusWith<DurableCatalog::Entry> DurableCatalogImpl::_importEntry(OperationCont
_catalogIdToEntryMap[res.getValue()] = {res.getValue(), ident, nss};
opCtx->recoveryUnit()->registerChange(std::make_unique<AddIdentChange>(this, res.getValue()));
- LOGV2_DEBUG(
- 5095101, 1, "imported meta data", "nss"_attr = nss.ns(), "metadata"_attr = res.getValue());
+ LOGV2_DEBUG(5095101, 1, "imported meta data", logAttrs(nss), "metadata"_attr = res.getValue());
return {{res.getValue(), ident, nss}};
}
@@ -655,8 +654,8 @@ StatusWith<std::string> DurableCatalogImpl::newOrphanedIdent(OperationContext* o
LOGV2_DEBUG(22213,
1,
- "stored meta data for orphaned collection {ns} @ {res_getValue}",
- "ns"_attr = ns,
+ "stored meta data for orphaned collection {namespace} @ {res_getValue}",
+ logAttrs(ns),
"res_getValue"_attr = res.getValue());
return {ns.ns()};
}
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
index b7bf9183be4..b1eff76f9fb 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -1361,8 +1361,8 @@ Status WiredTigerKVEngine::createRecordStore(OperationContext* opCtx,
WT_SESSION* s = session.getSession();
LOGV2_DEBUG(22331,
2,
- "WiredTigerKVEngine::createRecordStore ns: {ns} uri: {uri} config: {config}",
- "ns"_attr = ns,
+ "WiredTigerKVEngine::createRecordStore ns: {namespace} uri: {uri} config: {config}",
+ logAttrs(NamespaceString(ns)),
"uri"_attr = uri,
"config"_attr = config);
return wtRCToStatus(s->create(s, uri.c_str(), config.c_str()));
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
index 6990b3a9ff5..e8f4f9b09b4 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp
@@ -905,7 +905,8 @@ WiredTigerRecordStore::~WiredTigerRecordStore() {
}
if (!isTemp()) {
- LOGV2_DEBUG(22395, 1, "~WiredTigerRecordStore for: {ns}", "ns"_attr = ns());
+ LOGV2_DEBUG(
+ 22395, 1, "~WiredTigerRecordStore for: {namespace}", logAttrs(NamespaceString(ns())));
} else {
LOGV2_DEBUG(22396,
1,