Dropping a collection can take a long time under WiredTiger because can require freeing a large number of allocated buffers. See
SERVER-17907 for information on reproducing.
While this is occuring creating a new collection may be blocked for a substantial time. The create was accomplished in this test by inserting a record into a non-existent collection, so the stack traces below show the createCollection happening within insertOne. It is blocked in two different places:
- From A to B it's blocked waiting for the db lock. This occurs synchronously with the drop command itself, which is busy freeing buffers.
- From B to C it's blocked waiting to update the metadata table. This occurs while synchronously with dropAllQueued (not shown in the screenshot below), which is also busy freeing buffers.
Total timeline below is about 3.5 minutes, so total time blocked is about 2 minutes.