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

Don't log a Top entry in ~AutoGetCollectionForRead() if database is dropped

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Diagnostics
    • Query Execution
    • 0

      We expect that Top does not contain entries for collections which no longer exist. When a database is dropped, we clear all of the collections in that database from Top. However, consider the following scenario:

      1. We drop some database; say test. dropDatabase acquires a database lock in mode X.
      2. dropDatabase takes a while, and the cursor timeout thread runs on a collection in test.
      3. The cursor timeout thread uses AutoGetCollectionForRead and acquires a database lock in mode IS.
      4. The cursor timeout thread blocks until dropDatabase succeeds. After completing its work, the destructor of AutoGetCollectionForRead logs an entry in Top, even though the namespace no longer exists.

      We should fix the destructor of AutoGetCollectionForRead so that this logging does not occur if the database has been dropped. Note that the trivial fix of only calling Top::record() if _autoColl->getDb() != nullptr is not sufficient because this breaks Top recording for views. (Specifically, AutoGetCollectionOrViewForRead destroys its _autoColl when releasing its locks after resolving a view.)

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            kyle.suarez@mongodb.com Kyle Suarez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: