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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 3.7.9
    • Fix Version/s: None
    • Component/s: MMAPv1, Storage
    • Labels:
      None
    • Operating System:
      ALL
    • Linked BF Score:
      55

      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

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: