While testing a simple workload that creates and drops collections in a tight loop (see below), I noticed that many drop operations could not be completed immediately and instead were queued and retried later.
Since the queuing and retrying is expensive, I looked into what was causing the drops to fail the first time and noticed that there could be cursors active in the session used for the drop operation that were not being closed before attempting the drop.
Test:
collections=100000 mongo --eval " for (var i=0; i<$collections; i++) { c = db['c' + i] c.insert({a:i, b:i, c:i}) c.drop() } "
The fix is to call closeAllCursors(uri) on the enclosing session.
- related to
-
WT-3471 Clear out each session's table cache
- Closed