Details
Description
Using the repro below, interrupting repairDatabase in MMAP may keep a UUID registered to a deleted collection.
repairDatabase unregisters the UUID from the original collection by calling UUIDCatalog::onDropCollection and re-registers the UUID with the temporary one when it calls createCollection(). If this process fails at any point due to interruption, repair should re-register the original collection in the UUID catalog.
diff --git a/src/mongo/db/storage/mmap_v1/repair_database.cpp b/src/mongo/db/storage/mmap_v1/repair_database.cpp
|
index 416ff14063..573ed55676 100644
|
--- a/src/mongo/db/storage/mmap_v1/repair_database.cpp
|
+++ b/src/mongo/db/storage/mmap_v1/repair_database.cpp
|
@@ -444,6 +444,7 @@ Status MMAPV1Engine::repairDatabase(OperationContext* opCtx,
|
// need both in case journaling is disabled
|
MongoFile::flushAll(opCtx, true);
|
|
+ uassertStatusOK({ErrorCodes::Interrupted, "Interrupted!"});
|
opCtx->checkForInterrupt();
|
}
|
repro.js:
db.foo.insert({a: 1})
|
db.runCommand({repairDatabase: 1})
|
db.runCommand({collMod: 'foo', usePowerOf2Sizes: true})
|
Attachments
Issue Links
- duplicates
-
SERVER-30930 Collections are not registered in UUIDCatalog when repairDatabase command fails with MMAPv1 storage engine
-
- Closed
-