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

Drop database could drop new collections after stepdown

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 5.2.0, 5.0.4, 5.1.0-rc3
    • Sharding
    • None
    • Fully Compatible
    • ALL
    • v5.1, v5.0
    • Sharding EMEA 2021-11-01
    • 148

    Description

      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.

      Attachments

        1. repro.js
          1.0 kB
          Marcos José Grillo Ramirez
        2. repro.patch
          2 kB
          Marcos José Grillo Ramirez

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: