summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/catalog/capped_utils.cpp26
-rw-r--r--src/mongo/db/catalog/coll_mod.cpp7
-rw-r--r--src/mongo/db/catalog/collection_impl.cpp12
-rw-r--r--src/mongo/db/catalog/collection_info_cache_impl.cpp2
-rw-r--r--src/mongo/db/catalog/create_collection.cpp8
-rw-r--r--src/mongo/db/catalog/database_impl.cpp25
-rw-r--r--src/mongo/db/catalog/database_test.cpp4
-rw-r--r--src/mongo/db/catalog/drop_collection.cpp2
-rw-r--r--src/mongo/db/catalog/drop_indexes.cpp8
-rw-r--r--src/mongo/db/catalog/index_catalog_impl.cpp14
-rw-r--r--src/mongo/db/catalog/index_key_validate.cpp2
-rw-r--r--src/mongo/db/catalog/multi_index_block.cpp10
-rw-r--r--src/mongo/db/catalog/namespace_uuid_cache.cpp4
-rw-r--r--src/mongo/db/catalog/rename_collection.cpp25
-rw-r--r--src/mongo/db/catalog/rename_collection_test.cpp4
15 files changed, 70 insertions, 83 deletions
diff --git a/src/mongo/db/catalog/capped_utils.cpp b/src/mongo/db/catalog/capped_utils.cpp
index 431e23fa6ff..6e34677f61d 100644
--- a/src/mongo/db/catalog/capped_utils.cpp
+++ b/src/mongo/db/catalog/capped_utils.cpp
@@ -63,7 +63,7 @@ mongo::Status mongo::emptyCapped(OperationContext* opCtx, const NamespaceString&
if (userInitiatedWritesAndNotPrimary) {
return Status(ErrorCodes::NotMaster,
str::stream() << "Not primary while truncating collection: "
- << collectionName.ns());
+ << collectionName);
}
Database* db = autoDb.getDb();
@@ -77,14 +77,12 @@ mongo::Status mongo::emptyCapped(OperationContext* opCtx, const NamespaceString&
if (collectionName.isSystem() && !collectionName.isSystemDotProfile()) {
return Status(ErrorCodes::IllegalOperation,
- str::stream() << "Cannot truncate a system collection: "
- << collectionName.ns());
+ str::stream() << "Cannot truncate a system collection: " << collectionName);
}
if (collectionName.isVirtualized()) {
return Status(ErrorCodes::IllegalOperation,
- str::stream() << "Cannot truncate a virtual collection: "
- << collectionName.ns());
+ str::stream() << "Cannot truncate a virtual collection: " << collectionName);
}
if ((repl::ReplicationCoordinator::get(opCtx)->getReplicationMode() !=
@@ -92,7 +90,7 @@ mongo::Status mongo::emptyCapped(OperationContext* opCtx, const NamespaceString&
collectionName.isOplog()) {
return Status(ErrorCodes::OplogOperationUnsupported,
str::stream() << "Cannot truncate a live oplog while replicating: "
- << collectionName.ns());
+ << collectionName);
}
BackgroundOperation::assertNoBgOpInProgForNs(collectionName.ns());
@@ -124,24 +122,22 @@ void mongo::cloneCollectionAsCapped(OperationContext* opCtx,
Collection* fromCollection = db->getCollection(opCtx, fromNss);
if (!fromCollection) {
uassert(ErrorCodes::CommandNotSupportedOnView,
- str::stream() << "cloneCollectionAsCapped not supported for views: "
- << fromNss.ns(),
+ str::stream() << "cloneCollectionAsCapped not supported for views: " << fromNss,
!db->getViewCatalog()->lookup(opCtx, fromNss.ns()));
uasserted(ErrorCodes::NamespaceNotFound,
- str::stream() << "source collection " << fromNss.ns() << " does not exist");
+ str::stream() << "source collection " << fromNss << " does not exist");
}
uassert(ErrorCodes::NamespaceNotFound,
- str::stream() << "source collection " << fromNss.ns()
+ str::stream() << "source collection " << fromNss
<< " is currently in a drop-pending state.",
!fromNss.isDropPendingNamespace());
uassert(ErrorCodes::NamespaceExists,
- str::stream() << "cloneCollectionAsCapped failed - destination collection "
- << toNss.ns()
+ str::stream() << "cloneCollectionAsCapped failed - destination collection " << toNss
<< " already exists. source collection: "
- << fromNss.ns(),
+ << fromNss,
!db->getCollection(opCtx, toNss));
// create new collection
@@ -257,7 +253,7 @@ void mongo::convertToCapped(OperationContext* opCtx,
!repl::ReplicationCoordinator::get(opCtx)->canAcceptWritesFor(opCtx, collectionName);
uassert(ErrorCodes::NotMaster,
- str::stream() << "Not primary while converting " << collectionName.ns()
+ str::stream() << "Not primary while converting " << collectionName
<< " to a capped collection",
!userInitiatedWritesAndNotPrimary);
@@ -273,7 +269,7 @@ void mongo::convertToCapped(OperationContext* opCtx,
uassertStatusOKWithContext(tmpNameResult,
str::stream()
<< "Cannot generate temporary collection namespace to convert "
- << collectionName.ns()
+ << collectionName
<< " to a capped collection");
const auto& longTmpName = tmpNameResult.getValue();
diff --git a/src/mongo/db/catalog/coll_mod.cpp b/src/mongo/db/catalog/coll_mod.cpp
index 4b56491555e..22432c2dbc6 100644
--- a/src/mongo/db/catalog/coll_mod.cpp
+++ b/src/mongo/db/catalog/coll_mod.cpp
@@ -140,7 +140,7 @@ StatusWith<CollModRequest> parseCollModRequest(OperationContext* opCtx,
if (!cmr.idx) {
return Status(ErrorCodes::IndexNotFound,
str::stream() << "cannot find index " << indexName << " for ns "
- << nss.ns());
+ << nss);
}
} else {
std::vector<const IndexDescriptor*> indexes;
@@ -160,7 +160,7 @@ StatusWith<CollModRequest> parseCollModRequest(OperationContext* opCtx,
} else if (indexes.empty()) {
return Status(ErrorCodes::IndexNotFound,
str::stream() << "cannot find index " << keyPattern << " for ns "
- << nss.ns());
+ << nss);
}
cmr.idx = indexes[0];
@@ -334,8 +334,7 @@ Status _collModInternal(OperationContext* opCtx,
if (userInitiatedWritesAndNotPrimary) {
return Status(ErrorCodes::NotMaster,
- str::stream() << "Not primary while setting collection options on "
- << nss.ns());
+ str::stream() << "Not primary while setting collection options on " << nss);
}
BSONObjBuilder oplogEntryBuilder;
diff --git a/src/mongo/db/catalog/collection_impl.cpp b/src/mongo/db/catalog/collection_impl.cpp
index 54c44632f46..85243b4519d 100644
--- a/src/mongo/db/catalog/collection_impl.cpp
+++ b/src/mongo/db/catalog/collection_impl.cpp
@@ -318,8 +318,7 @@ StatusWithMatchExpression CollectionImpl::parseValidator(
if (ns().isSystem() && !ns().isDropPendingNamespace()) {
return {ErrorCodes::InvalidOptions,
- str::stream() << "Document validators not allowed on system collection "
- << ns().ns()
+ str::stream() << "Document validators not allowed on system collection " << ns()
<< (_uuid ? " with UUID " + _uuid->toString() : "")};
}
@@ -391,7 +390,7 @@ Status CollectionImpl::insertDocuments(OperationContext* opCtx,
return Status(ErrorCodes::InternalError,
str::stream()
<< "Collection::insertDocument got document without _id for ns:"
- << _ns.ns());
+ << _ns);
}
auto status = checkValidation(opCtx, it->doc);
@@ -1264,11 +1263,10 @@ Status CollectionImpl::validate(OperationContext* opCtx,
opCtx, _indexCatalog.get(), &indexNsResultsMap, &keysPerIndex, level, results, output);
if (!results->valid) {
- log(LogComponent::kIndex) << "validating collection " << ns().toString() << " failed"
- << uuidString << endl;
+ log(LogComponent::kIndex) << "validating collection " << ns() << " failed"
+ << uuidString;
} else {
- log(LogComponent::kIndex) << "validated collection " << ns().toString() << uuidString
- << endl;
+ log(LogComponent::kIndex) << "validated collection " << ns() << uuidString;
}
} catch (DBException& e) {
if (ErrorCodes::isInterruption(e.code())) {
diff --git a/src/mongo/db/catalog/collection_info_cache_impl.cpp b/src/mongo/db/catalog/collection_info_cache_impl.cpp
index 0065fd0ad01..3bba186d9e7 100644
--- a/src/mongo/db/catalog/collection_info_cache_impl.cpp
+++ b/src/mongo/db/catalog/collection_info_cache_impl.cpp
@@ -174,7 +174,7 @@ void CollectionInfoCacheImpl::notifyOfQuery(OperationContext* opCtx,
}
void CollectionInfoCacheImpl::clearQueryCache() {
- LOG(1) << _collection->ns().ns() << ": clearing plan cache - collection info cache reset";
+ LOG(1) << _collection->ns() << ": clearing plan cache - collection info cache reset";
if (NULL != _planCache.get()) {
_planCache->clear();
}
diff --git a/src/mongo/db/catalog/create_collection.cpp b/src/mongo/db/catalog/create_collection.cpp
index 18a0506a680..29a85f69726 100644
--- a/src/mongo/db/catalog/create_collection.cpp
+++ b/src/mongo/db/catalog/create_collection.cpp
@@ -104,7 +104,7 @@ Status createCollection(OperationContext* opCtx,
if (opCtx->writesAreReplicated() &&
!repl::ReplicationCoordinator::get(opCtx)->canAcceptWritesFor(opCtx, nss)) {
return Status(ErrorCodes::NotMaster,
- str::stream() << "Not primary while creating collection " << nss.ns());
+ str::stream() << "Not primary while creating collection " << nss);
}
if (collectionOptions.isView()) {
@@ -211,7 +211,7 @@ Status createCollectionForApplyOps(OperationContext* opCtx,
str::stream() << "Cannot generate temporary "
"collection namespace for applyOps "
"create command: collection: "
- << newCollName.ns()));
+ << newCollName));
}
const auto& tmpName = tmpNameResult.getValue();
// It is ok to log this because this doesn't happen very frequently.
@@ -235,9 +235,7 @@ Status createCollectionForApplyOps(OperationContext* opCtx,
// name, just rename it to 'newCollName'.
if (catalog.lookupCollectionByUUID(uuid)) {
uassert(40655,
- str::stream() << "Invalid name " << redact(newCollName.ns())
- << " for UUID "
- << uuid.toString(),
+ str::stream() << "Invalid name " << newCollName << " for UUID " << uuid,
currentName.db() == newCollName.db());
Status status =
db->renameCollection(opCtx, currentName.ns(), newCollName.ns(), stayTemp);
diff --git a/src/mongo/db/catalog/database_impl.cpp b/src/mongo/db/catalog/database_impl.cpp
index 688f2adc935..e7f0cae9b9d 100644
--- a/src/mongo/db/catalog/database_impl.cpp
+++ b/src/mongo/db/catalog/database_impl.cpp
@@ -237,7 +237,7 @@ Collection* DatabaseImpl::_getOrCreateCollectionInstance(OperationContext* opCtx
unique_ptr<RecordStore> rs(_dbEntry->getRecordStore(nss.ns()));
if (rs.get() == nullptr) {
- severe() << "Record store did not exist. Collection: " << nss.ns() << " UUID: "
+ severe() << "Record store did not exist. Collection: " << nss << " UUID: "
<< (uuid ? uuid->toString() : "none"); // if cce exists, so should this
fassertFailedNoTrace(50936);
}
@@ -518,8 +518,7 @@ Status DatabaseImpl::dropCollectionEvenIfSystem(OperationContext* opCtx,
// Use massert() to be consistent with IndexCatalog::dropAllIndexes().
auto numIndexesInProgress = collection->getIndexCatalog()->numIndexesInProgress(opCtx);
massert(40461,
- str::stream() << "cannot drop collection " << fullns.ns() << " (" << uuidString
- << ") when "
+ str::stream() << "cannot drop collection " << fullns << " (" << uuidString << ") when "
<< numIndexesInProgress
<< " index builds in progress.",
numIndexesInProgress == 0);
@@ -750,8 +749,7 @@ void DatabaseImpl::_checkCanCreateCollection(OperationContext* opCtx,
const NamespaceString& nss,
const CollectionOptions& options) {
massert(17399,
- str::stream() << "Cannot create collection " << nss.ns()
- << " - collection already exists.",
+ str::stream() << "Cannot create collection " << nss << " - collection already exists.",
getCollection(opCtx, nss) == nullptr);
uassertNamespaceNotIndex(nss.ns(), "createCollection");
@@ -761,7 +759,7 @@ void DatabaseImpl::_checkCanCreateCollection(OperationContext* opCtx,
// This check only applies for actual collections, not indexes or other types of ns.
uassert(17381,
- str::stream() << "fully qualified namespace " << nss.ns() << " is too long "
+ str::stream() << "fully qualified namespace " << nss << " is too long "
<< "(max is "
<< NamespaceString::MaxNsCollectionLen
<< " bytes)",
@@ -770,7 +768,7 @@ void DatabaseImpl::_checkCanCreateCollection(OperationContext* opCtx,
uassert(17316, "cannot create a blank collection", nss.coll() > 0);
uassert(28838, "cannot create a non-capped oplog collection", options.capped || !nss.isOplog());
uassert(ErrorCodes::DatabaseDropPending,
- str::stream() << "Cannot create collection " << nss.ns()
+ str::stream() << "Cannot create collection " << nss
<< " - database is in the process of being dropped.",
!_dropPending);
}
@@ -816,7 +814,7 @@ Collection* DatabaseImpl::createCollection(OperationContext* opCtx,
bool generatedUUID = false;
if (!optionsWithUUID.uuid) {
if (!canAcceptWrites) {
- std::string msg = str::stream() << "Attempted to create a new collection " << nss.ns()
+ std::string msg = str::stream() << "Attempted to create a new collection " << nss
<< " without a UUID";
severe() << msg;
uasserted(ErrorCodes::InvalidOptions, msg);
@@ -871,8 +869,7 @@ Collection* DatabaseImpl::createCollection(OperationContext* opCtx,
} else {
// autoIndexId: false is only allowed on unreplicated collections.
uassert(50001,
- str::stream() << "autoIndexId:false is not allowed for collection "
- << nss.ns()
+ str::stream() << "autoIndexId:false is not allowed for collection " << nss
<< " because it can be replicated",
!nss.isReplicated());
}
@@ -1008,17 +1005,17 @@ Status DatabaseImpl::userCreateNS(OperationContext* opCtx,
LOG(1) << "create collection " << fullns << ' ' << collectionOptions.toBSON();
if (!NamespaceString::validCollectionComponent(fullns.ns()))
- return Status(ErrorCodes::InvalidNamespace, str::stream() << "invalid ns: " << fullns.ns());
+ return Status(ErrorCodes::InvalidNamespace, str::stream() << "invalid ns: " << fullns);
Collection* collection = getCollection(opCtx, fullns);
if (collection)
return Status(ErrorCodes::NamespaceExists,
- str::stream() << "a collection '" << fullns.ns() << "' already exists");
+ str::stream() << "a collection '" << fullns << "' already exists");
if (getViewCatalog()->lookup(opCtx, fullns.ns()))
return Status(ErrorCodes::NamespaceExists,
- str::stream() << "a view '" << fullns.ns() << "' already exists");
+ str::stream() << "a view '" << fullns << "' already exists");
// Validate the collation, if there is one.
std::unique_ptr<CollatorInterface> collator;
@@ -1091,7 +1088,7 @@ Status DatabaseImpl::userCreateNS(OperationContext* opCtx,
} else {
invariant(
createCollection(opCtx, fullns.ns(), collectionOptions, createDefaultIndexes, idIndex),
- str::stream() << "Collection creation failed after validating options: " << fullns.ns()
+ str::stream() << "Collection creation failed after validating options: " << fullns
<< ". Options: "
<< collectionOptions.toBSON());
}
diff --git a/src/mongo/db/catalog/database_test.cpp b/src/mongo/db/catalog/database_test.cpp
index 2237571c7e6..dd2f57cf694 100644
--- a/src/mongo/db/catalog/database_test.cpp
+++ b/src/mongo/db/catalog/database_test.cpp
@@ -167,7 +167,7 @@ TEST_F(DatabaseTest, CreateCollectionThrowsExceptionWhenDatabaseIsInADropPending
db->createCollection(_opCtx.get(), _nss.ns()),
AssertionException,
ErrorCodes::DatabaseDropPending,
- (StringBuilder() << "Cannot create collection " << _nss.ns()
+ (StringBuilder() << "Cannot create collection " << _nss
<< " - database is in the process of being dropped.")
.stringData());
});
@@ -550,7 +550,7 @@ TEST_F(DatabaseTest, CreateCollectionProhibitsReplicatedCollectionsWithoutIdInde
db->createCollection(_opCtx.get(), _nss.ns(), options),
AssertionException,
50001,
- (StringBuilder() << "autoIndexId:false is not allowed for collection " << _nss.ns()
+ (StringBuilder() << "autoIndexId:false is not allowed for collection " << _nss
<< " because it can be replicated")
.stringData());
});
diff --git a/src/mongo/db/catalog/drop_collection.cpp b/src/mongo/db/catalog/drop_collection.cpp
index 8d3eddd947d..66fd0e68f0f 100644
--- a/src/mongo/db/catalog/drop_collection.cpp
+++ b/src/mongo/db/catalog/drop_collection.cpp
@@ -87,7 +87,7 @@ Status dropCollection(OperationContext* opCtx,
if (userInitiatedWritesAndNotPrimary) {
return Status(ErrorCodes::NotMaster,
str::stream() << "Not primary while dropping collection "
- << collectionName.ns());
+ << collectionName);
}
WriteUnitOfWork wunit(opCtx);
diff --git a/src/mongo/db/catalog/drop_indexes.cpp b/src/mongo/db/catalog/drop_indexes.cpp
index 34f3875155c..d2a074a895a 100644
--- a/src/mongo/db/catalog/drop_indexes.cpp
+++ b/src/mongo/db/catalog/drop_indexes.cpp
@@ -166,7 +166,7 @@ Status wrappedRun(OperationContext* opCtx,
for (auto indexNameElem : indexElem.Array()) {
if (indexNameElem.type() != String) {
return Status(ErrorCodes::TypeMismatch,
- str::stream() << "dropIndexes " << collection->ns().ns() << " ("
+ str::stream() << "dropIndexes " << collection->ns() << " ("
<< collection->uuid()
<< ") failed to drop multiple indexes "
<< indexElem.toString(false)
@@ -176,7 +176,7 @@ Status wrappedRun(OperationContext* opCtx,
auto indexToDelete = indexNameElem.String();
auto status = dropIndexByName(opCtx, collection, indexCatalog, indexToDelete);
if (!status.isOK()) {
- return status.withContext(str::stream() << "dropIndexes " << collection->ns().ns()
+ return status.withContext(str::stream() << "dropIndexes " << collection->ns()
<< " ("
<< collection->uuid()
<< ") failed to drop multiple indexes "
@@ -207,7 +207,7 @@ Status dropIndexes(OperationContext* opCtx,
if (userInitiatedWritesAndNotPrimary) {
return Status(ErrorCodes::NotMaster,
- str::stream() << "Not primary while dropping indexes in " << nss.ns());
+ str::stream() << "Not primary while dropping indexes in " << nss);
}
if (!serverGlobalParams.quiet.load()) {
@@ -220,7 +220,7 @@ Status dropIndexes(OperationContext* opCtx,
if (!db || !collection) {
if (db && db->getViewCatalog()->lookup(opCtx, nss.ns())) {
return Status(ErrorCodes::CommandNotSupportedOnView,
- str::stream() << "Cannot drop indexes on view " << nss.ns());
+ str::stream() << "Cannot drop indexes on view " << nss);
}
return Status(ErrorCodes::NamespaceNotFound, "ns not found");
diff --git a/src/mongo/db/catalog/index_catalog_impl.cpp b/src/mongo/db/catalog/index_catalog_impl.cpp
index dabaee65ed0..52df6a8e887 100644
--- a/src/mongo/db/catalog/index_catalog_impl.cpp
+++ b/src/mongo/db/catalog/index_catalog_impl.cpp
@@ -143,7 +143,7 @@ IndexCatalogEntry* IndexCatalogImpl::_setupInMemoryStructures(
Status status = _isSpecOk(opCtx, descriptor->infoObj());
if (!status.isOK() && status != ErrorCodes::IndexAlreadyExists) {
severe() << "Found an invalid index " << descriptor->infoObj() << " on the "
- << _collection->ns().ns() << " collection: " << redact(status);
+ << _collection->ns() << " collection: " << redact(status);
fassertFailedNoTrace(28782);
}
@@ -200,7 +200,7 @@ Status IndexCatalogImpl::checkUnfinished() const {
return Status(ErrorCodes::InternalError,
str::stream() << "IndexCatalog has left over indexes that must be cleared"
<< " ns: "
- << _collection->ns().ns());
+ << _collection->ns());
}
std::unique_ptr<IndexCatalog::IndexIterator> IndexCatalogImpl::getIndexIterator(
@@ -292,7 +292,7 @@ StatusWith<BSONObj> IndexCatalogImpl::createIndexOnEmptyCollection(OperationCont
BSONObj spec) {
invariant(opCtx->lockState()->isCollectionLockedForMode(_collection->ns().toString(), MODE_X));
invariant(_collection->numRecords(opCtx) == 0,
- str::stream() << "Collection must be empty. Collection: " << _collection->ns().ns()
+ str::stream() << "Collection must be empty. Collection: " << _collection->ns()
<< " UUID: "
<< _collection->uuid()
<< " Count: "
@@ -424,7 +424,7 @@ Status IndexCatalogImpl::_isSpecOk(OperationContext* opCtx, const BSONObj& spec)
str::stream() << "the \"ns\" field of the index spec '"
<< specNamespace.valueStringData()
<< "' does not match the collection name '"
- << nss.ns()
+ << nss
<< "'");
// logical name of the index
@@ -454,7 +454,7 @@ Status IndexCatalogImpl::_isSpecOk(OperationContext* opCtx, const BSONObj& spec)
if (indexNamespace.size() > NamespaceString::MaxNsLen)
return Status(ErrorCodes::CannotCreateIndex,
str::stream() << "namespace name generated from index name \""
- << indexNamespace.ns()
+ << indexNamespace
<< "\" is too long (127 byte max)");
}
@@ -694,8 +694,8 @@ Status IndexCatalogImpl::_doesSpecConflictWithExisting(OperationContext* opCtx,
}
if (numIndexesTotal(opCtx) >= _maxNumIndexesAllowed) {
- string s = str::stream() << "add index fails, too many indexes for "
- << _collection->ns().ns() << " key:" << key;
+ string s = str::stream() << "add index fails, too many indexes for " << _collection->ns()
+ << " key:" << key;
log() << s;
return Status(ErrorCodes::CannotCreateIndex, s);
}
diff --git a/src/mongo/db/catalog/index_key_validate.cpp b/src/mongo/db/catalog/index_key_validate.cpp
index ddddb7648d8..b9b9f9117a5 100644
--- a/src/mongo/db/catalog/index_key_validate.cpp
+++ b/src/mongo/db/catalog/index_key_validate.cpp
@@ -326,7 +326,7 @@ StatusWith<BSONObj> validateIndexSpec(
<< "' ("
<< ns
<< ") doesn't match the namespace '"
- << expectedNamespace.ns()
+ << expectedNamespace
<< "'"};
}
diff --git a/src/mongo/db/catalog/multi_index_block.cpp b/src/mongo/db/catalog/multi_index_block.cpp
index 93389f0567b..fbddcd68dd0 100644
--- a/src/mongo/db/catalog/multi_index_block.cpp
+++ b/src/mongo/db/catalog/multi_index_block.cpp
@@ -114,7 +114,7 @@ MultiIndexBlock::~MultiIndexBlock() {
_opCtx->getServiceContext()->getOpObserver()->onOpMessage(
_opCtx,
BSON("msg" << std::string(str::stream() << "Failing index builds. Coll: "
- << _collection->ns().ns())));
+ << _collection->ns())));
}
wunit.commit();
return;
@@ -170,7 +170,7 @@ StatusWith<std::vector<BSONObj>> MultiIndexBlock::init(const std::vector<BSONObj
return {ErrorCodes::IndexBuildAborted,
str::stream() << "Index build aborted: " << _abortReason
<< ". Cannot initialize index builder: "
- << _collection->ns().ns()
+ << _collection->ns()
<< "("
<< *_collection->uuid()
<< "): "
@@ -578,7 +578,7 @@ Status MultiIndexBlock::drainBackgroundWrites() {
return {ErrorCodes::IndexBuildAborted,
str::stream() << "Index build aborted: " << _abortReason
<< ". Cannot complete drain phase: "
- << _collection->ns().ns()
+ << _collection->ns()
<< "("
<< *_collection->uuid()
<< ")"};
@@ -609,7 +609,7 @@ Status MultiIndexBlock::checkConstraints() {
return {ErrorCodes::IndexBuildAborted,
str::stream() << "Index build aborted: " << _abortReason
<< ". Cannot complete constraint checking: "
- << _collection->ns().ns()
+ << _collection->ns()
<< "("
<< *_collection->uuid()
<< ")"};
@@ -646,7 +646,7 @@ Status MultiIndexBlock::commit(stdx::function<void(const BSONObj& spec)> onCreat
return {ErrorCodes::IndexBuildAborted,
str::stream() << "Index build aborted: " << _abortReason
<< ". Cannot commit index builder: "
- << _collection->ns().ns()
+ << _collection->ns()
<< "("
<< *_collection->uuid()
<< ")"};
diff --git a/src/mongo/db/catalog/namespace_uuid_cache.cpp b/src/mongo/db/catalog/namespace_uuid_cache.cpp
index 1f15952a91b..5d0f78c6d0e 100644
--- a/src/mongo/db/catalog/namespace_uuid_cache.cpp
+++ b/src/mongo/db/catalog/namespace_uuid_cache.cpp
@@ -53,7 +53,7 @@ void NamespaceUUIDCache::ensureNamespaceInCache(const NamespaceString& nss, Coll
if (it == _cache.end()) {
// Add ns, uuid pair to the cache if it does not yet exist.
invariant(_cache.try_emplace(ns, uuid).second == true);
- LOG(3) << "NamespaceUUIDCache: registered namespace " << nss.ns() << " with UUID " << uuid;
+ LOG(3) << "NamespaceUUIDCache: registered namespace " << nss << " with UUID " << uuid;
} else if (it->second != uuid) {
// If ns exists in the cache, make sure it does not correspond to another uuid.
@@ -67,7 +67,7 @@ void NamespaceUUIDCache::ensureNamespaceInCache(const NamespaceString& nss, Coll
void NamespaceUUIDCache::evictNamespace(const NamespaceString& nss) {
size_t evicted = _cache.erase(nss.ns());
if (evicted) {
- LOG(2) << "NamespaceUUIDCache: evicted namespace " << nss.ns();
+ LOG(2) << "NamespaceUUIDCache: evicted namespace " << nss;
}
invariant(evicted <= 1);
}
diff --git a/src/mongo/db/catalog/rename_collection.cpp b/src/mongo/db/catalog/rename_collection.cpp
index c0bb212b6dd..a6b71b91e7d 100644
--- a/src/mongo/db/catalog/rename_collection.cpp
+++ b/src/mongo/db/catalog/rename_collection.cpp
@@ -87,15 +87,15 @@ Status renameTargetCollectionToTmp(OperationContext* opCtx,
if (!tmpNameResult.isOK()) {
return tmpNameResult.getStatus().withContext(
str::stream() << "Cannot generate a temporary collection name for the target "
- << targetNs.ns()
+ << targetNs
<< " ("
<< targetUUID
<< ") so that the source"
- << sourceNs.ns()
+ << sourceNs
<< " ("
<< sourceUUID
<< ") could be renamed to "
- << targetNs.ns());
+ << targetNs);
}
const auto& tmpName = tmpNameResult.getValue();
const bool stayTemp = true;
@@ -107,9 +107,9 @@ Status renameTargetCollectionToTmp(OperationContext* opCtx,
wunit.commit();
- log() << "Successfully renamed the target " << targetNs.ns() << " (" << targetUUID
- << ") to " << tmpName << " so that the source " << sourceNs.ns() << " (" << sourceUUID
- << ") could be renamed to " << targetNs.ns();
+ log() << "Successfully renamed the target " << targetNs << " (" << targetUUID << ") to "
+ << tmpName << " so that the source " << sourceNs << " (" << sourceUUID
+ << ") could be renamed to " << targetNs;
return Status::OK();
});
@@ -150,9 +150,8 @@ Status renameCollectionCommon(OperationContext* opCtx,
if (userInitiatedWritesAndNotPrimary) {
return Status(ErrorCodes::NotMaster,
- str::stream() << "Not primary while renaming collection " << source.ns()
- << " to "
- << target.ns());
+ str::stream() << "Not primary while renaming collection " << source << " to "
+ << target);
}
auto databaseHolder = DatabaseHolder::get(opCtx);
@@ -164,7 +163,7 @@ Status renameCollectionCommon(OperationContext* opCtx,
if (!sourceColl) {
if (sourceDB && sourceDB->getViewCatalog()->lookup(opCtx, source.ns()))
return Status(ErrorCodes::CommandNotSupportedOnView,
- str::stream() << "cannot rename view: " << source.ns());
+ str::stream() << "cannot rename view: " << source);
return Status(ErrorCodes::NamespaceNotFound, "source namespace does not exist");
}
@@ -238,7 +237,7 @@ Status renameCollectionCommon(OperationContext* opCtx,
}
} else if (targetDB->getViewCatalog()->lookup(opCtx, target.ns())) {
return Status(ErrorCodes::NamespaceExists,
- str::stream() << "a view already exists with that name: " << target.ns());
+ str::stream() << "a view already exists with that name: " << target);
}
// When reapplying oplog entries (such as in the case of initial sync) we need
@@ -377,9 +376,9 @@ Status renameCollectionCommon(OperationContext* opCtx,
targetDB->makeUniqueCollectionNamespace(opCtx, "tmp%%%%%.renameCollection");
if (!tmpNameResult.isOK()) {
return tmpNameResult.getStatus().withContext(
- str::stream() << "Cannot generate temporary collection name to rename " << source.ns()
+ str::stream() << "Cannot generate temporary collection name to rename " << source
<< " to "
- << target.ns());
+ << target);
}
const auto& tmpName = tmpNameResult.getValue();
diff --git a/src/mongo/db/catalog/rename_collection_test.cpp b/src/mongo/db/catalog/rename_collection_test.cpp
index e38f5e5ab64..ff4a6f18493 100644
--- a/src/mongo/db/catalog/rename_collection_test.cpp
+++ b/src/mongo/db/catalog/rename_collection_test.cpp
@@ -417,7 +417,7 @@ void _createIndexOnEmptyCollection(OperationContext* opCtx,
AutoGetCollection autoColl(opCtx, nss, MODE_X);
auto collection = autoColl.getCollection();
ASSERT_TRUE(collection) << "Cannot create index on empty collection " << nss
- << " because collection " << nss.ns() << " does not exist.";
+ << " because collection " << nss << " does not exist.";
auto indexInfoObj = BSON(
"v" << int(IndexDescriptor::kLatestIndexVersion) << "key" << BSON("a" << 1) << "name"
@@ -442,7 +442,7 @@ void _insertDocument(OperationContext* opCtx, const NamespaceString& nss, const
AutoGetCollection autoColl(opCtx, nss, MODE_X);
auto collection = autoColl.getCollection();
ASSERT_TRUE(collection) << "Cannot insert document " << doc << " into collection " << nss
- << " because collection " << nss.ns() << " does not exist.";
+ << " because collection " << nss << " does not exist.";
WriteUnitOfWork wuow(opCtx);
OpDebug* const opDebug = nullptr;