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

Drop can fail because it is run in a session with cached cursors

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.6.0-rc0
    • Affects Version/s: None
    • Component/s: Storage
    • Labels:
      None
    • Fully Compatible
    • Storage 2017-08-21, Storage 2017-09-11, Storage 2017-10-02

      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.

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

              Created:
              Updated:
              Resolved: