With the introduction of AutoGetDb::ensureDbExists() and AutoGetCollection::ensureDbExists() in SERVER-45955, there is no longer a need for AutoGetOrCreateDb and removing it would simplify the codebase. Going through and directly translating the uses should be trivial, however anywhere we use this pattern:
AutoGetOrCreateDb autoDb(opCtx, ns.db(), MODE_IX); Lock::CollectionLock collLock(opCtx, ns, MODE_IX); Database* db = autoDb.getDb();
should be changed into
AutoGetCollection autoColl(opCtx, ns, MODE_IX); Database* db = autoColl.ensureDbExists();
This change leads to implicitly creating the system.views collection hitting this uassert, which we would should investigate whether we can circumvent.
- is related to
-
SERVER-37283 View graph cycle on expressive lookup secondary read
- Closed
-
SERVER-45955 findAndModify should not take exclusive locks
- Closed
-
SERVER-53256 Make a new lock helper to encapsulate DBLock and CollectionLock usage
- Closed
- related to
-
SERVER-56511 use AutoGetOrCreateCollection to create system.views in _createCollection()
- Closed