[SERVER-48245] index drop allowed on drop-pending collection Created: 15/May/20  Updated: 29/Oct/23  Resolved: 04/Jun/20

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 4.7.0, 4.4.2

Type: Bug Priority: Major - P3
Reporter: Louis Williams Assignee: Benety Goh
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
is related to SERVER-46892 two phase index build allowed to star... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4
Sprint: Execution Team 2020-06-15
Participants:
Linked BF Score: 19

 Description   

When a collection is being dropped using old-style two phase drops (system.drop.* introduced in 3.6), there is a small window in which we may be able to drop indexes on the collection. using its drop-pending namespace. This produces an sequence of operations that may be problematic for a secondary to apply. This is not a common scenario in production because it requires the user to be able to derive the drop-pending namespace of the dropped collection, either from the logs or the oplog, and run the dropIndexes command on the primary before it is permanently removed by the DropPendingCollectionReaper.

------ OLD DESCRIPTION BELOW ------

Old title:  Old-style two-phase drops replicate 'dropIndexes' operations after collection 'drop'

Old-style two-phase drops write an initial 'drop' oplog entry to rename the collection to a drop-pending namespace. The DropPendingCollectionReaper asynchronously drops the collection, which also drops the indexes and replicates the "dropIndexes" oplog entries.

As a result, the "drop" oplog entry replicates before the "dropIndexes" entry. If a secondary has already applied the "drop" and performed the second drop phase, when it applies the "dropIndexes" operation it will encounter a NamespaceNotFound error in replication, which leads to a crash.



 Comments   
Comment by Githook User [ 08/Sep/20 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-48245 disallow index drops on drop-pending namespaces (system.drop.*) if we are primary.

(cherry picked from commit 34b89472092922061c29dbfe72f1f8e4051f7856)
Branch: v4.4
https://github.com/mongodb/mongo/commit/020b0463d95f8b3d337351955598842528b38c47

Comment by Githook User [ 08/Sep/20 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-48245 add js test for index drops on drop-pending namespaces

(cherry picked from commit 93ffa1d804ba78948b1def7134678c28f1dea1b8)
Branch: v4.4
https://github.com/mongodb/mongo/commit/b17e4354cb6bb35ae3db7cde9bacf5e60a101f56

Comment by Githook User [ 08/Sep/20 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-48245 add uuid to "CMD: dropIndexes" log message. update checkReplState() arguments

(cherry picked from commit 6762642daa0cd703873af2d9e364a723d5a64c58)
Branch: v4.4
https://github.com/mongodb/mongo/commit/568f701aa5d51f35d9736b5b3ee5fba59800416f

Comment by Benety Goh [ 04/Jun/20 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-48245 disallow index drops on drop-pending namespaces (system.drop.*) if we are primary.
Branch: master
https://github.com/mongodb/mongo/commit/34b89472092922061c29dbfe72f1f8e4051f7856

Comment by Benety Goh [ 03/Jun/20 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-48245 add js test for index drops on drop-pending namespaces
Branch: master
https://github.com/mongodb/mongo/commit/93ffa1d804ba78948b1def7134678c28f1dea1b8

Comment by Githook User [ 03/Jun/20 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-48245 add uuid to "CMD: dropIndexes" log message. update checkReplState() arguments
Branch: master
https://github.com/mongodb/mongo/commit/6762642daa0cd703873af2d9e364a723d5a64c58

Comment by Benety Goh [ 31/May/20 ]

We should look into how the DropPendingCollectionReaper is able to replicate "dropIndexes" oplog entries while replicated writes are disabled.

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