diff options
Diffstat (limited to 'src/mongo/db/storage/durable_catalog_impl.cpp')
| -rw-r--r-- | src/mongo/db/storage/durable_catalog_impl.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mongo/db/storage/durable_catalog_impl.cpp b/src/mongo/db/storage/durable_catalog_impl.cpp index 10015081c93..13b86f9af07 100644 --- a/src/mongo/db/storage/durable_catalog_impl.cpp +++ b/src/mongo/db/storage/durable_catalog_impl.cpp @@ -547,8 +547,15 @@ bool DurableCatalogImpl::isResumableIndexBuildIdent(StringData ident) const { return ident.find(kResumableIndexBuildIdentStem) != std::string::npos; } -StatusWith<std::string> DurableCatalogImpl::newOrphanedIdent( - OperationContext* opCtx, std::string ident, const CollectionOptions& optionsWithUUID) { +bool DurableCatalogImpl::isCollectionIdent(StringData ident) const { + // Internal idents prefixed "internal-" should not be considered collections, because + // they are not eligible for orphan recovery through repair. + return ident.find("collection-") != std::string::npos || + ident.find("collection/") != std::string::npos; +} + +StatusWith<std::string> DurableCatalogImpl::newOrphanedIdent(OperationContext* opCtx, + std::string ident) { // The collection will be named local.orphan.xxxxx. std::string identNs = ident; std::replace(identNs.begin(), identNs.end(), '-', '_'); @@ -556,6 +563,9 @@ StatusWith<std::string> DurableCatalogImpl::newOrphanedIdent( NamespaceString nss(NamespaceString(NamespaceString::kOrphanCollectionDb, NamespaceString::kOrphanCollectionPrefix + identNs)); + // Generate a new UUID for the orphaned collection. + CollectionOptions optionsWithUUID; + optionsWithUUID.uuid.emplace(UUID::gen()); BSONObj obj; { BSONObjBuilder b; |
