Details
Description
In Database::createCollection(), if we uassert on creating the _id index, the AddCollectionChange rollback logic will hit an invariant because the UUID for the collection is not removed from the UUIDCatalog.
|
database_impl.cpp |
|
738
|
opCtx->recoveryUnit()->registerChange(new AddCollectionChange(opCtx, this, ns)); |
739
|
Collection* collection = _getOrCreateCollectionInstance(opCtx, nss);
|
740
|
invariant(collection);
|
741
|
_collections[ns] = collection;
|
742
|
|
743
|
BSONObj fullIdIndexSpec;
|
744
|
|
745
|
if (createIdIndex) { |
746
|
if (collection->requiresIdIndex()) { |
747
|
if (optionsWithUUID.autoIndexId == CollectionOptions::YES || |
748
|
optionsWithUUID.autoIndexId == CollectionOptions::DEFAULT) {
|
749
|
const auto featureCompatibilityVersion = |
750
|
serverGlobalParams.featureCompatibility.version.load();
|
751
|
IndexCatalog* ic = collection->getIndexCatalog();
|
752
|
fullIdIndexSpec = uassertStatusOK(ic->createIndexOnEmptyCollection(
|
753
|
opCtx,
|
754
|
!idIndex.isEmpty() ? idIndex
|
755
|
: ic->getDefaultIdIndexSpec(featureCompatibilityVersion)));
|
756
|
}
|
757
|
}
|
Attachments
Issue Links
- is related to
-
SERVER-30229 Clean up UUIDCatalog registration
-
- Closed
-