Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-25500

Collection drops can cause busy applications to stall

    • Fully Compatible
    • ALL

      The reason drops are problematic is that WiredTiger makes a table drop fail if there are any open cursors on the table. MongoDB caches cursors because opening them can be expensive (as we see here). That means the low-level drop operation often fails, and in that case, the MongoDB session cache will close all cached sessions and cursors to allow the drop to succeed.

      A lot of the impact of drops is caused by contention for the mutex in WiredTiger that protects the list of handles, because the new sessions need to acquire that lock to open a cursor on a table for the first time.

      Calling closeAll in the session cache when a drop fails is overly aggressive. There is no need to close all sessions, and in fact only cursors on tables we are trying to drop need to be closed. Even if we switch to closing all cursors in that case, the impact will be substantially lower, because a WiredTiger session can reopen a cursor on a table it has cached without acquiring any locks.

            Assignee:
            michael.cahill@mongodb.com Michael Cahill (Inactive)
            Reporter:
            michael.cahill@mongodb.com Michael Cahill (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            22 Start watching this issue

              Created:
              Updated:
              Resolved: