[SERVER-60811] Drop database could drop new collections after stepdown Created: 19/Oct/21  Updated: 29/Oct/23  Resolved: 26/Oct/21

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 5.2.0, 5.0.4, 5.1.0-rc3

Type: Bug Priority: Major - P3
Reporter: Marcos José Grillo Ramirez Assignee: Allison Easton
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File repro.js     Text File repro.patch    
Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.1, v5.0
Sprint: Sharding EMEA 2021-11-01
Participants:
Linked BF Score: 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.



 Comments   
Comment by Githook User [ 28/Oct/21 ]

Author:

{'name': 'Allison Easton', 'email': 'allison.easton@mongodb.com', 'username': 'allisoneaston'}

Message: SERVER-60811 Drop database could drop new collections after stepdown

(cherry picked from commit fe46db1c852640e6c63f3cfa2291fc6a728e88ac)
Branch: v5.0
https://github.com/mongodb/mongo/commit/5e66bb60366b51a910ce9ebd67c2947fb6f06d03

Comment by Githook User [ 28/Oct/21 ]

Author:

{'name': 'Allison Easton', 'email': 'allison.easton@mongodb.com', 'username': 'allisoneaston'}

Message: SERVER-60811 Drop database could drop new collections after stepdown

(cherry picked from commit fe46db1c852640e6c63f3cfa2291fc6a728e88ac)
Branch: v5.1
https://github.com/mongodb/mongo/commit/e3705868686077780c2fd0f6b32ac7c3ec699817

Comment by Githook User [ 25/Oct/21 ]

Author:

{'name': 'Allison Easton', 'email': 'allison.easton@mongodb.com', 'username': 'allisoneaston'}

Message: SERVER-60811 Drop database could drop new collections after stepdown
Branch: master
https://github.com/mongodb/mongo/commit/fe46db1c852640e6c63f3cfa2291fc6a728e88ac

Generated at Thu Feb 08 05:50:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.