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

shardsvrDropDatabase should always join existing coordinator

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.2.0, 5.0.5, 5.1.1
    • Affects Version/s: 5.0.3, 5.1.0-rc0
    • Component/s: Sharding
    • Labels:
    • Fully Compatible
    • ALL
    • v5.1, v5.0
    • Sharding EMEA 2021-11-01, Sharding EMEA 2021-11-15, Sharding EMEA 2021-11-29
    • 132

      In the following scenario taken from the description of the linked BF, a drop database command can return that the operation was completed successfully when the database was actually not dropped. The drop database command should check the version of the existing coordinator to ensure that it is not joining the coordinator for a different database.

      1. the test creates unsharded collection "test.coll"
      2. mongos sends a _shardsvrDropDatabase to the primary shard s0:n0
      3. s0:n0 start a drop database coordinator dropDBcor_1
      4. s0:n0 drop "test.coll"
      5. s0:n0 manage to drop the database "test" (by removing the db entry in the config.databases) but the coordinator (dropDBcor_1) is still running.
      6. s0:n0 steps down and s0:n1 became the new primary of shard 0
      7. mongos receives an InterruptedDueToReplStateChange on the original _shardsvrDropDatabase command
      8. mongos retries the dropDatabase command but find out that the database have been already dropped. So it will simply return OK to the client
      9. mongos creates new database and collection "test.coll" while the old coordinator (dropDBcor_1) is still running.
      10. mongos attempts to drop the database "test" for the second time by sending a _shardsvrDropDatabase to s0:n1 and since dropDBcor_1 is still running it will join it. The problem is that `dropDBcor_1` is already at a late stage of the execution (running the cleanup phase) and it won't drop again the database.

            allison.easton@mongodb.com Allison Easton
            tommaso.tocci@mongodb.com Tommaso Tocci
            0 Vote for this issue
            4 Start watching this issue