summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog
diff options
context:
space:
mode:
authorXiangyu Yao <xiangyu.yao@mongodb.com>2019-07-11 18:37:42 -0400
committerXiangyu Yao <xiangyu.yao@mongodb.com>2019-07-15 13:30:02 -0400
commit70a3df4dd5d102b2370a871c9182be281100a487 (patch)
tree4101519c5505800900caf30b1730c5fc6cdaeb5a /src/mongo/db/catalog
parentbb4ba528dd4254c33ac77026f94bc287b590ff3c (diff)
downloadmongo-70a3df4dd5d102b2370a871c9182be281100a487.tar.gz
SERVER-42194 Make Collection always hold a UUID (rather than optional UUID)
Diffstat (limited to 'src/mongo/db/catalog')
-rw-r--r--src/mongo/db/catalog/capped_utils.cpp3
-rw-r--r--src/mongo/db/catalog/catalog_control.cpp8
-rw-r--r--src/mongo/db/catalog/coll_mod.cpp3
-rw-r--r--src/mongo/db/catalog/collection.h2
-rw-r--r--src/mongo/db/catalog/collection_catalog_test.cpp6
-rw-r--r--src/mongo/db/catalog/collection_compact.cpp2
-rw-r--r--src/mongo/db/catalog/collection_impl.cpp19
-rw-r--r--src/mongo/db/catalog/collection_impl.h6
-rw-r--r--src/mongo/db/catalog/collection_mock.h4
-rw-r--r--src/mongo/db/catalog/database_impl.cpp15
-rw-r--r--src/mongo/db/catalog/drop_collection.cpp2
-rw-r--r--src/mongo/db/catalog/drop_database.cpp2
-rw-r--r--src/mongo/db/catalog/drop_indexes.cpp2
-rw-r--r--src/mongo/db/catalog/index_builds_manager.cpp2
-rw-r--r--src/mongo/db/catalog/index_catalog_impl.cpp4
-rw-r--r--src/mongo/db/catalog/multi_index_block.cpp17
-rw-r--r--src/mongo/db/catalog/rename_collection.cpp12
-rw-r--r--src/mongo/db/catalog/rename_collection_test.cpp4
18 files changed, 50 insertions, 63 deletions
diff --git a/src/mongo/db/catalog/capped_utils.cpp b/src/mongo/db/catalog/capped_utils.cpp
index 889ca73ddd2..c7ceead85a0 100644
--- a/src/mongo/db/catalog/capped_utils.cpp
+++ b/src/mongo/db/catalog/capped_utils.cpp
@@ -91,8 +91,7 @@ Status emptyCapped(OperationContext* opCtx, const NamespaceString& collectionNam
}
BackgroundOperation::assertNoBgOpInProgForNs(collectionName.ns());
- IndexBuildsCoordinator::get(opCtx)->assertNoIndexBuildInProgForCollection(
- collection->uuid().get());
+ IndexBuildsCoordinator::get(opCtx)->assertNoIndexBuildInProgForCollection(collection->uuid());
WriteUnitOfWork wuow(opCtx);
diff --git a/src/mongo/db/catalog/catalog_control.cpp b/src/mongo/db/catalog/catalog_control.cpp
index 95c1381f91e..ab925ab0a97 100644
--- a/src/mongo/db/catalog/catalog_control.cpp
+++ b/src/mongo/db/catalog/catalog_control.cpp
@@ -174,11 +174,9 @@ void openCatalog(OperationContext* opCtx, const MinVisibleTimestampMap& minVisib
str::stream() << "failed to get valid collection pointer for namespace "
<< collNss);
- auto uuid = collection->uuid();
- invariant(uuid);
-
- if (minVisibleTimestampMap.count(*uuid) > 0) {
- collection->setMinimumVisibleSnapshot(minVisibleTimestampMap.find(*uuid)->second);
+ if (minVisibleTimestampMap.count(collection->uuid()) > 0) {
+ collection->setMinimumVisibleSnapshot(
+ minVisibleTimestampMap.find(collection->uuid())->second);
}
// If this is the oplog collection, re-establish the replication system's cached pointer
diff --git a/src/mongo/db/catalog/coll_mod.cpp b/src/mongo/db/catalog/coll_mod.cpp
index 9aac38954e8..45c57acc17a 100644
--- a/src/mongo/db/catalog/coll_mod.cpp
+++ b/src/mongo/db/catalog/coll_mod.cpp
@@ -268,8 +268,7 @@ Status _collModInternal(OperationContext* opCtx,
// progress.
BackgroundOperation::assertNoBgOpInProgForNs(nss);
if (coll) {
- IndexBuildsCoordinator::get(opCtx)->assertNoIndexBuildInProgForCollection(
- coll->uuid().get());
+ IndexBuildsCoordinator::get(opCtx)->assertNoIndexBuildInProgForCollection(coll->uuid());
}
// If db/collection/view does not exist, short circuit and return.
diff --git a/src/mongo/db/catalog/collection.h b/src/mongo/db/catalog/collection.h
index 15057e3124d..750d2ea9411 100644
--- a/src/mongo/db/catalog/collection.h
+++ b/src/mongo/db/catalog/collection.h
@@ -206,7 +206,7 @@ public:
*/
virtual void setNs(NamespaceString nss) = 0;
- virtual OptionalCollectionUUID uuid() const = 0;
+ virtual UUID uuid() const = 0;
virtual const IndexCatalog* getIndexCatalog() const = 0;
virtual IndexCatalog* getIndexCatalog() = 0;
diff --git a/src/mongo/db/catalog/collection_catalog_test.cpp b/src/mongo/db/catalog/collection_catalog_test.cpp
index 32bf6ab8047..e9985074fd8 100644
--- a/src/mongo/db/catalog/collection_catalog_test.cpp
+++ b/src/mongo/db/catalog/collection_catalog_test.cpp
@@ -271,7 +271,7 @@ public:
auto coll = std::make_unique<CollectionMock>(nss);
auto uuid = coll->uuid();
- catalog.registerCollection(uuid.get(), std::move(coll));
+ catalog.registerCollection(uuid, std::move(coll));
}
int numEntries = 0;
@@ -289,7 +289,7 @@ public:
void tearDown() {
for (auto it = catalog.begin("resourceDb"); it != catalog.end(); ++it) {
auto coll = *it;
- auto uuid = coll->uuid().get();
+ auto uuid = coll->uuid();
if (!coll) {
break;
}
@@ -358,7 +358,7 @@ TEST_F(CollectionCatalogResourceTest, LookupMissingCollectionResource) {
TEST_F(CollectionCatalogResourceTest, RemoveCollection) {
const std::string collNs = "resourceDb.coll1";
auto coll = catalog.lookupCollectionByNamespace(NamespaceString(collNs));
- catalog.deregisterCollection(coll->uuid().get());
+ catalog.deregisterCollection(coll->uuid());
auto rid = ResourceId(RESOURCE_COLLECTION, collNs);
ASSERT(!catalog.lookupResourceName(rid));
}
diff --git a/src/mongo/db/catalog/collection_compact.cpp b/src/mongo/db/catalog/collection_compact.cpp
index ab41a04327c..eae4770532d 100644
--- a/src/mongo/db/catalog/collection_compact.cpp
+++ b/src/mongo/db/catalog/collection_compact.cpp
@@ -127,7 +127,7 @@ StatusWith<CompactStats> compactCollection(OperationContext* opCtx,
// If the storage engine doesn't support compacting in place, make sure no background operations
// or indexes are running.
- const UUID collectionUUID = collection->uuid().get();
+ const UUID collectionUUID = collection->uuid();
BackgroundOperation::assertNoBgOpInProgForNs(collectionNss);
IndexBuildsCoordinator::get(opCtx)->assertNoIndexBuildInProgForCollection(collectionUUID);
diff --git a/src/mongo/db/catalog/collection_impl.cpp b/src/mongo/db/catalog/collection_impl.cpp
index fdde33beeb5..f9a02f46309 100644
--- a/src/mongo/db/catalog/collection_impl.cpp
+++ b/src/mongo/db/catalog/collection_impl.cpp
@@ -196,7 +196,7 @@ using logger::LogComponent;
CollectionImpl::CollectionImpl(OperationContext* opCtx,
const NamespaceString& nss,
- OptionalCollectionUUID uuid,
+ UUID uuid,
std::unique_ptr<RecordStore> recordStore)
: _magic(kMagicNumber),
_ns(nss),
@@ -324,13 +324,15 @@ StatusWithMatchExpression CollectionImpl::parseValidator(
if (ns().isSystem() && !ns().isDropPendingNamespace()) {
return {ErrorCodes::InvalidOptions,
str::stream() << "Document validators not allowed on system collection " << ns()
- << (_uuid ? " with UUID " + _uuid->toString() : "")};
+ << " with UUID "
+ << _uuid};
}
if (ns().isOnInternalDb()) {
return {ErrorCodes::InvalidOptions,
str::stream() << "Document validators are not allowed on collection " << ns().ns()
- << (_uuid ? " with UUID " + _uuid->toString() : "")
+ << " with UUID "
+ << _uuid
<< " in the "
<< ns().db()
<< " internal database"};
@@ -701,8 +703,7 @@ RecordId CollectionImpl::updateDocument(OperationContext* opCtx,
invariant(sid == opCtx->recoveryUnit()->getSnapshotId());
args->updatedDoc = newDoc;
- invariant(uuid());
- OplogUpdateEntryArgs entryArgs(*args, ns(), *uuid());
+ OplogUpdateEntryArgs entryArgs(*args, ns(), _uuid);
getGlobalServiceContext()->getOpObserver()->onUpdate(opCtx, entryArgs);
return {oldLocation};
@@ -732,8 +733,7 @@ StatusWith<RecordData> CollectionImpl::updateDocumentWithDamages(
if (newRecStatus.isOK()) {
args->updatedDoc = newRecStatus.getValue().toBson();
- invariant(uuid());
- OplogUpdateEntryArgs entryArgs(*args, ns(), *uuid());
+ OplogUpdateEntryArgs entryArgs(*args, ns(), _uuid);
getGlobalServiceContext()->getOpObserver()->onUpdate(opCtx, entryArgs);
}
return newRecStatus;
@@ -1285,7 +1285,7 @@ void _validateCatalogEntry(OperationContext* opCtx,
BSONObj validatorDoc,
ValidateResults* results) {
CollectionOptions options = DurableCatalog::get(opCtx)->getCollectionOptions(opCtx, coll->ns());
- addErrorIfUnequal(options.uuid, coll->uuid(), "UUID", results);
+ addErrorIfUnequal(*options.uuid, coll->uuid(), "UUID", results);
const CollatorInterface* collation = coll->getDefaultCollator();
addErrorIfUnequal(options.collation.isEmpty(), !collation, "simple collation", results);
if (!options.collation.isEmpty() && collation)
@@ -1333,8 +1333,7 @@ Status CollectionImpl::validate(OperationContext* opCtx,
opCtx, &indexConsistency, level, _indexCatalog.get(), &indexNsResultsMap);
// Validate the record store
- std::string uuidString = str::stream()
- << " (UUID: " << (uuid() ? uuid()->toString() : "none") << ")";
+ std::string uuidString = str::stream() << " (UUID: " << _uuid << ")";
log(LogComponent::kIndex) << "validating collection " << ns() << uuidString;
_validateRecordStore(
opCtx, _recordStore.get(), level, background, &indexValidator, results, output);
diff --git a/src/mongo/db/catalog/collection_impl.h b/src/mongo/db/catalog/collection_impl.h
index a9a2c6fbfde..46b56f805e1 100644
--- a/src/mongo/db/catalog/collection_impl.h
+++ b/src/mongo/db/catalog/collection_impl.h
@@ -47,7 +47,7 @@ public:
explicit CollectionImpl(OperationContext* opCtx,
const NamespaceString& nss,
- OptionalCollectionUUID uuid,
+ UUID uuid,
std::unique_ptr<RecordStore> recordStore);
~CollectionImpl();
@@ -78,7 +78,7 @@ public:
void setNs(NamespaceString nss) final;
- OptionalCollectionUUID uuid() const {
+ UUID uuid() const {
return _uuid;
}
@@ -389,7 +389,7 @@ private:
int _magic;
NamespaceString _ns;
- OptionalCollectionUUID _uuid;
+ UUID _uuid;
// The RecordStore may be null during a repair operation.
std::unique_ptr<RecordStore> _recordStore; // owned
diff --git a/src/mongo/db/catalog/collection_mock.h b/src/mongo/db/catalog/collection_mock.h
index cb78c52b72f..19eb457bd7a 100644
--- a/src/mongo/db/catalog/collection_mock.h
+++ b/src/mongo/db/catalog/collection_mock.h
@@ -273,7 +273,7 @@ public:
std::abort();
}
- OptionalCollectionUUID uuid() const {
+ UUID uuid() const {
return _uuid;
}
@@ -282,7 +282,7 @@ public:
}
private:
- OptionalCollectionUUID _uuid = UUID::gen();
+ UUID _uuid = UUID::gen();
NamespaceString _ns;
std::unique_ptr<IndexCatalog> _indexCatalog;
};
diff --git a/src/mongo/db/catalog/database_impl.cpp b/src/mongo/db/catalog/database_impl.cpp
index 1388714f3f7..d5c57cc8db4 100644
--- a/src/mongo/db/catalog/database_impl.cpp
+++ b/src/mongo/db/catalog/database_impl.cpp
@@ -348,13 +348,12 @@ Status DatabaseImpl::dropCollectionEvenIfSystem(OperationContext* opCtx,
auto numRecords = collection->numRecords(opCtx);
auto uuid = collection->uuid();
- auto uuidString = uuid ? uuid.get().toString() : "no UUID";
// Make sure no indexes builds are in progress.
// Use massert() to be consistent with IndexCatalog::dropAllIndexes().
auto numIndexesInProgress = collection->getIndexCatalog()->numIndexesInProgress(opCtx);
massert(ErrorCodes::BackgroundOperationInProgressForNamespace,
- str::stream() << "cannot drop collection " << nss << " (" << uuidString << ") when "
+ str::stream() << "cannot drop collection " << nss << " (" << uuid << ") when "
<< numIndexesInProgress
<< " index builds in progress.",
numIndexesInProgress == 0);
@@ -385,7 +384,7 @@ Status DatabaseImpl::dropCollectionEvenIfSystem(OperationContext* opCtx,
_dropCollectionIndexes(opCtx, nss, collection);
auto commitTimestamp = opCtx->recoveryUnit()->getCommitTimestamp();
- log() << "dropCollection: " << nss << " (" << uuidString
+ log() << "dropCollection: " << nss << " (" << uuid
<< ") - storage engine will take ownership of drop-pending collection with optime "
<< dropOpTime << " and commit timestamp " << commitTimestamp;
if (dropOpTime.isNull()) {
@@ -425,7 +424,7 @@ Status DatabaseImpl::dropCollectionEvenIfSystem(OperationContext* opCtx,
// Rename collection using drop-pending namespace generated from drop optime.
auto dpns = nss.makeDropPendingNamespace(dropOpTime);
const bool stayTemp = true;
- log() << "dropCollection: " << nss << " (" << uuidString
+ log() << "dropCollection: " << nss << " (" << uuid
<< ") - renaming to drop-pending collection: " << dpns << " with drop optime "
<< dropOpTime;
{
@@ -454,7 +453,7 @@ void DatabaseImpl::_dropCollectionIndexes(OperationContext* opCtx,
Status DatabaseImpl::_finishDropCollection(OperationContext* opCtx,
const NamespaceString& nss,
Collection* collection) const {
- UUID uuid = *collection->uuid();
+ UUID uuid = collection->uuid();
log() << "Finishing collection drop for " << nss << " (" << uuid << ").";
auto status = DurableCatalog::get(opCtx)->dropCollection(opCtx, nss);
@@ -507,8 +506,8 @@ Status DatabaseImpl::renameCollection(OperationContext* opCtx,
<< toNss);
}
- log() << "renameCollection: renaming collection " << collToRename->uuid()->toString()
- << " from " << fromNss << " to " << toNss;
+ log() << "renameCollection: renaming collection " << collToRename->uuid() << " from " << fromNss
+ << " to " << toNss;
Top::get(opCtx->getServiceContext()).collectionDropped(fromNss);
@@ -651,7 +650,7 @@ Collection* DatabaseImpl::createCollection(OperationContext* opCtx,
});
auto& catalog = CollectionCatalog::get(opCtx);
- auto uuid = ownedCollection->uuid().get();
+ auto uuid = ownedCollection->uuid();
catalog.registerCollection(uuid, std::move(ownedCollection));
opCtx->recoveryUnit()->onRollback([uuid, &catalog] { catalog.deregisterCollection(uuid); });
diff --git a/src/mongo/db/catalog/drop_collection.cpp b/src/mongo/db/catalog/drop_collection.cpp
index 5a8c2828f63..b5f30ae2a3e 100644
--- a/src/mongo/db/catalog/drop_collection.cpp
+++ b/src/mongo/db/catalog/drop_collection.cpp
@@ -130,7 +130,7 @@ Status _dropCollection(OperationContext* opCtx,
int numIndexes = coll->getIndexCatalog()->numIndexesTotal(opCtx);
BackgroundOperation::assertNoBgOpInProgForNs(collectionName.ns());
- IndexBuildsCoordinator::get(opCtx)->assertNoIndexBuildInProgForCollection(coll->uuid().get());
+ IndexBuildsCoordinator::get(opCtx)->assertNoIndexBuildInProgForCollection(coll->uuid());
Status status =
systemCollectionMode == DropCollectionSystemCollectionMode::kDisallowSystemCollectionDrops
? db->dropCollection(opCtx, collectionName, dropOpTime)
diff --git a/src/mongo/db/catalog/drop_database.cpp b/src/mongo/db/catalog/drop_database.cpp
index 2602c6e59d5..fd471f8ad50 100644
--- a/src/mongo/db/catalog/drop_database.cpp
+++ b/src/mongo/db/catalog/drop_database.cpp
@@ -189,7 +189,7 @@ Status dropDatabase(OperationContext* opCtx, const std::string& dbName) {
BackgroundOperation::assertNoBgOpInProgForNs(nss.ns());
IndexBuildsCoordinator::get(opCtx)->assertNoIndexBuildInProgForCollection(
- db->getCollection(opCtx, nss)->uuid().get());
+ db->getCollection(opCtx, nss)->uuid());
writeConflictRetry(opCtx, "dropDatabase_collection", nss.ns(), [&] {
WriteUnitOfWork wunit(opCtx);
diff --git a/src/mongo/db/catalog/drop_indexes.cpp b/src/mongo/db/catalog/drop_indexes.cpp
index b74a55f00cf..cd56e85e2b6 100644
--- a/src/mongo/db/catalog/drop_indexes.cpp
+++ b/src/mongo/db/catalog/drop_indexes.cpp
@@ -228,7 +228,7 @@ Status dropIndexes(OperationContext* opCtx,
BackgroundOperation::assertNoBgOpInProgForNs(nss);
IndexBuildsCoordinator::get(opCtx)->assertNoIndexBuildInProgForCollection(
- collection->uuid().get());
+ collection->uuid());
WriteUnitOfWork wunit(opCtx);
OldClientContext ctx(opCtx, nss.ns());
diff --git a/src/mongo/db/catalog/index_builds_manager.cpp b/src/mongo/db/catalog/index_builds_manager.cpp
index cbc9217ee12..fe816ce7dc4 100644
--- a/src/mongo/db/catalog/index_builds_manager.cpp
+++ b/src/mongo/db/catalog/index_builds_manager.cpp
@@ -112,7 +112,7 @@ Status IndexBuildsManager::setUpIndexBuild(OperationContext* opCtx,
<< ": indexes: " << indexes.size();
} else {
log() << "Index build initialized: " << buildUUID << ": " << nss << " ("
- << *collection->uuid() << " ): indexes: " << indexes.size();
+ << collection->uuid() << " ): indexes: " << indexes.size();
}
return Status::OK();
diff --git a/src/mongo/db/catalog/index_catalog_impl.cpp b/src/mongo/db/catalog/index_catalog_impl.cpp
index a0a467bccc2..571a5705201 100644
--- a/src/mongo/db/catalog/index_catalog_impl.cpp
+++ b/src/mongo/db/catalog/index_catalog_impl.cpp
@@ -1064,9 +1064,7 @@ int IndexCatalogImpl::numIndexesReady(OperationContext* opCtx) const {
log() << " index: " << i;
}
- if (_collection->uuid()) {
- log() << "collection uuid: " << _collection->uuid();
- }
+ log() << "collection uuid: " << _collection->uuid();
invariant(itIndexes.size() == completedIndexes.size(),
"The number of ready indexes reported in the collection metadata catalog did "
diff --git a/src/mongo/db/catalog/multi_index_block.cpp b/src/mongo/db/catalog/multi_index_block.cpp
index 6bb769f533a..c3065c1a13b 100644
--- a/src/mongo/db/catalog/multi_index_block.cpp
+++ b/src/mongo/db/catalog/multi_index_block.cpp
@@ -77,7 +77,7 @@ void MultiIndexBlock::cleanUpAfterBuild(OperationContext* opCtx, Collection* col
if (_collectionUUID) {
// init() was previously called with a collection pointer, so ensure that the same
// collection is being provided for clean up and the interface in not being abused.
- invariant(_collectionUUID.get() == collection->uuid().get());
+ invariant(_collectionUUID.get() == collection->uuid());
}
if (!_needToCleanup && !_indexes.empty()) {
@@ -201,18 +201,15 @@ StatusWith<std::vector<BSONObj>> MultiIndexBlock::init(OperationContext* opCtx,
str::stream() << "Index build aborted: " << _abortReason
<< ". Cannot initialize index builder: "
<< collection->ns()
- << (collection->uuid()
- ? (" (" + collection->uuid()->toString() + "): ")
- : ": ")
+ << " ("
+ << collection->uuid()
+ << "): "
<< indexSpecs.size()
<< " provided. First index spec: "
<< (indexSpecs.empty() ? BSONObj() : indexSpecs[0])};
}
- // UUIDs are not guaranteed during startup because the check happens after indexes are rebuilt.
- if (collection->uuid()) {
- _collectionUUID = collection->uuid().get();
- }
+ _collectionUUID = collection->uuid();
_buildIsCleanedUp = false;
@@ -366,7 +363,7 @@ Status MultiIndexBlock::insertAllDocumentsInCollection(OperationContext* opCtx,
// UUIDs are not guaranteed during startup because the check happens after indexes are rebuilt.
if (_collectionUUID) {
- invariant(_collectionUUID.get() == collection->uuid().get());
+ invariant(_collectionUUID.get() == collection->uuid());
}
// Refrain from persisting any multikey updates as a result from building the index. Instead,
@@ -707,7 +704,7 @@ Status MultiIndexBlock::commit(OperationContext* opCtx,
OnCommitFn onCommit) {
// UUIDs are not guaranteed during startup because the check happens after indexes are rebuilt.
if (_collectionUUID) {
- invariant(_collectionUUID.get() == collection->uuid().get());
+ invariant(_collectionUUID.get() == collection->uuid());
}
if (State::kAborted == _getState()) {
diff --git a/src/mongo/db/catalog/rename_collection.cpp b/src/mongo/db/catalog/rename_collection.cpp
index 2492fbac0d4..08047b91a31 100644
--- a/src/mongo/db/catalog/rename_collection.cpp
+++ b/src/mongo/db/catalog/rename_collection.cpp
@@ -117,8 +117,7 @@ Status checkSourceAndTargetNamespaces(OperationContext* opCtx,
}
BackgroundOperation::assertNoBgOpInProgForNs(source.ns());
- IndexBuildsCoordinator::get(opCtx)->assertNoIndexBuildInProgForCollection(
- sourceColl->uuid().get());
+ IndexBuildsCoordinator::get(opCtx)->assertNoIndexBuildInProgForCollection(sourceColl->uuid());
Collection* targetColl = db->getCollection(opCtx, target);
@@ -255,7 +254,7 @@ Status renameCollectionAndDropTarget(OperationContext* opCtx,
BackgroundOperation::assertNoBgOpInProgForNs(targetColl->ns().ns());
IndexBuildsCoordinator::get(opCtx)->assertNoIndexBuildInProgForCollection(
- targetColl->uuid().get());
+ targetColl->uuid());
auto status = db->dropCollection(opCtx, targetColl->ns(), renameOpTime);
if (!status.isOK())
@@ -381,7 +380,7 @@ Status renameCollectionWithinDBForApplyOps(OperationContext* opCtx,
if (uuidToDrop && uuidToDrop != targetColl->uuid()) {
// We need to rename the targetColl to a temporary name.
auto status = renameTargetCollectionToTmp(
- opCtx, source, sourceColl->uuid().get(), db, target, targetColl->uuid().get());
+ opCtx, source, sourceColl->uuid(), db, target, targetColl->uuid());
if (!status.isOK())
return status;
targetColl = nullptr;
@@ -462,8 +461,7 @@ Status renameBetweenDBs(OperationContext* opCtx,
"Cannot rename collections between a replicated and an unreplicated database"};
BackgroundOperation::assertNoBgOpInProgForNs(source.ns());
- IndexBuildsCoordinator::get(opCtx)->assertNoIndexBuildInProgForCollection(
- sourceColl->uuid().get());
+ IndexBuildsCoordinator::get(opCtx)->assertNoIndexBuildInProgForCollection(sourceColl->uuid());
auto targetDB = DatabaseHolder::get(opCtx)->getDb(opCtx, target.db());
@@ -585,7 +583,7 @@ Status renameBetweenDBs(OperationContext* opCtx,
for (const auto& indexToCopy : indexesToCopy) {
opObserver->onCreateIndex(opCtx,
tmpName,
- *(tmpColl->uuid()),
+ tmpColl->uuid(),
indexToCopy,
false // fromMigrate
);
diff --git a/src/mongo/db/catalog/rename_collection_test.cpp b/src/mongo/db/catalog/rename_collection_test.cpp
index 0b9c2d1639d..903461b9133 100644
--- a/src/mongo/db/catalog/rename_collection_test.cpp
+++ b/src/mongo/db/catalog/rename_collection_test.cpp
@@ -1163,9 +1163,9 @@ TEST_F(RenameCollectionTest, CollectionCatalogMappingRemainsIntactThroughRename)
auto& catalog = CollectionCatalog::get(_opCtx.get());
Collection* sourceColl = _getCollection_inlock(_opCtx.get(), _sourceNss);
ASSERT(sourceColl);
- ASSERT_EQ(sourceColl, catalog.lookupCollectionByUUID(*sourceColl->uuid()));
+ ASSERT_EQ(sourceColl, catalog.lookupCollectionByUUID(sourceColl->uuid()));
ASSERT_OK(renameCollection(_opCtx.get(), _sourceNss, _targetNss, {}));
- ASSERT_EQ(sourceColl, catalog.lookupCollectionByUUID(*sourceColl->uuid()));
+ ASSERT_EQ(sourceColl, catalog.lookupCollectionByUUID(sourceColl->uuid()));
}
TEST_F(RenameCollectionTest, FailRenameCollectionFromReplicatedToUnreplicatedDB) {