-
Type: Improvement
-
Resolution: Unresolved
-
Priority: 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:
- We drop some database; say test. dropDatabase acquires a database lock in mode X.
- dropDatabase takes a while, and the cursor timeout thread runs on a collection in test.
- The cursor timeout thread uses AutoGetCollectionForRead and acquires a database lock in mode IS.
- 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.)
- is related to
-
SERVER-26425 Top entries may remain if write conflict occurs during dropDatabase
- Closed