[SERVER-29874] Two Phase Drops: dropDatabase does not work with applyOps Created: 27/Jun/17  Updated: 30/Oct/23  Resolved: 29/Jun/17

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 3.5.10

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

Issue Links:
Related
related to SERVER-31436 dropDatabase must check `ReplicationC... Closed
related to SERVER-43458 Remove TempRelease in dropDatabase Closed
related to SERVER-29802 Non-atomic applyOps command should no... Closed
is related to SERVER-29277 Two Phase Drops: implement dropDataba... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Repl 2017-07-31
Participants:

 Description   

Since SERVER-29277, the dropDatabase waits for all collection drops to complete before removing the entry for the database from the catalog. To do this, the free function mongo::dropDatabase() needs to call either ReplicationCoordinator::awaitReplicationOfLastOpForClient() or ReplicationCoordinator::awaitReplication(). However, these functions fail when dropDatabase() is called from within an applyOps operation because applyOps executes all its given operations while holding the global lock.

To reproduce:

db.adminCommand({applyOps: [{op: 'c', ns: 'test.$cmd', o: {create: 't'}}, {op: 'c', ns: 'test.$cmd', o: {drop: 't'}}, {op: 'c', ns: 'test.$cmd', o: {dropDatabase: 1}}]})



 Comments   
Comment by Githook User [ 29/Jun/17 ]

Author:

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

Message: SERVER-29874 dropDatabase() releases locks when awaiting replication

This allows dropDatabase() to work with applyOps when we have to wait for
collection drops to replicate
Branch: master
https://github.com/mongodb/mongo/commit/57e3704f443df1fb071e0af81421ce2999fad767

Generated at Thu Feb 08 04:22:02 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.