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

Drop database could drop new collections after stepdown

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.2.0, 5.0.4, 5.1.0-rc3
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • Fully Compatible
    • ALL
    • v5.1, v5.0
    • Sharding EMEA 2021-11-01
    • 148

      The drop database command resends a drop collection command if finds that the previous execution was interrupted with a stepdown. This is done to ensure the collections are dropped even if a stepdown happened right after saving the coordinator document with the last collection to be dropped. However, if a stepdown happens after removing the database metadata and another shard manages to create a new database, then, the newly elected primary will end up dropping a collection that belongs to another database, which is not correct.

      A repro of this scenario can be found attached. In order to prevent this, we could clean the collection field of the coordinator document after all the collections are successfully dropped.

        1. repro.patch
          2 kB
        2. repro.js
          1.0 kB

            Assignee:
            allison.easton@mongodb.com Allison Easton
            Reporter:
            marcos.grillo@mongodb.com Marcos José Grillo Ramirez
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: