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
opCtx->recoveryUnit()->registerChange(new AddCollectionChange(opCtx, this, ns)); Collection* collection = _getOrCreateCollectionInstance(opCtx, nss); invariant(collection); _collections[ns] = collection; BSONObj fullIdIndexSpec; if (createIdIndex) { if (collection->requiresIdIndex()) { if (optionsWithUUID.autoIndexId == CollectionOptions::YES || optionsWithUUID.autoIndexId == CollectionOptions::DEFAULT) { const auto featureCompatibilityVersion = serverGlobalParams.featureCompatibility.version.load(); IndexCatalog* ic = collection->getIndexCatalog(); fullIdIndexSpec = uassertStatusOK(ic->createIndexOnEmptyCollection( opCtx, !idIndex.isEmpty() ? idIndex : ic->getDefaultIdIndexSpec(featureCompatibilityVersion))); } }
- is related to
-
SERVER-30229 Clean up UUIDCatalog registration
- Closed