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

Remove AutoGetOrCreateDb

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 5.0.0-rc0
    • None
    • Fully Compatible
    • Execution Team 2021-05-03

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              benety.goh@mongodb.com Benety Goh
              gregory.noma@mongodb.com Gregory Noma
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: