Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-3491

mongorestore fails if collection gets created during restore

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Tools and Replicator

      Problem Statement/Rationale

      The collectionExists variable is populated here

      https://github.com/mongodb/mongo-tools/blob/10c7902dc3246abdbadd467777cbe2eb2393ef60/mongorestore/restore.go#L297

       

      And then used here:

      https://github.com/mongodb/mongo-tools/blob/10c7902dc3246abdbadd467777cbe2eb2393ef60/mongorestore/restore.go#L369

       

      If a mongodb client creates the collection between the time when it is created and when it is checked, it results in restore failure
       
      Failed: mydb.mycollection: error creating collection mydb.mycollection: error running create command: a collection 'mydb.mycollection' already exists

      Steps to Reproduce

      Use a client that populates data into the collection at regular intervals. Delete the collection and run mongorestore. If executed sufficient number of times, this will hit this error.

      Expected Results

      This error should be ignored by mongorestore, since the intent is to create the collection anyway.

      Actual Results

      Restore fails.

      Additional Notes

       

            Assignee:
            jian.guan@mongodb.com Jian Guan
            Reporter:
            prkadalb@cisco.com Pradyumna Kadalbalkoti
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: