[SERVER-35088] MMAP repairDatabase should re-register the original collections with the UUID catalog when interrupted Created: 18/May/18  Updated: 06/Dec/22  Resolved: 18/May/18

Status: Closed
Project: Core Server
Component/s: MMAPv1, Storage
Affects Version/s: 3.7.9
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Louis Williams Assignee: Backlog - Storage Execution Team
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-30930 Collections are not registered in UUI... Closed
Related
Assigned Teams:
Storage Execution
Operating System: ALL
Participants:
Linked BF Score: 23

 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})



 Comments   
Comment by Louis Williams [ 18/May/18 ]

Duplicates SERVER-30930

Generated at Thu Feb 08 04:38:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.