Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-35088

MMAP repairDatabase should re-register the original collections with the UUID catalog when interrupted

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.7.9
    • Component/s: MMAPv1, Storage
    • None
    • Storage Execution
    • ALL
    • 23

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

            Assignee:
            backlog-server-execution [DO NOT USE] Backlog - Storage Execution Team
            Reporter:
            louis.williams@mongodb.com Louis Williams
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: