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

Rearrange lock helper (AutoGetCollection*) templating and inheritance to have AutoGetCollection and AutoGetCollectionLFR bases

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.8.0
    • Affects Version/s: None
    • Component/s: Storage
    • Labels:
    • Fully Compatible
    • Execution Team 2020-10-05

      Originally (v4.4), we had a AutoGetCollection class that handled getting the locks and collection state; and a AutoGetCollectionForRead that had a AutoGetCollection and did a lot of additional logic unrelated to the catalog state. We're going to need something like this:

      AutoGetCollection (as it used to be pre templating)

      a new AutoGetCollectionLFR (like the original AutoGetCollection but reduced logic because no db/coll locks, no RSTL either but should make it optional for future LFR catalog operations)

      AutoGetCollectionForReadBase (templated like AutoGetCollectionBase today, but for to allow AutoGetCollectionForRead logic to be shared for LFR and non-LFR reads)

      AutoGetCollectionForRead<AutoGetCollection> (inheriting AutoGetCollectionForReadBase)

      AutoGetCollectionForReadLFR<AutoGetCollectionLFR> (inheriting AutoGetCollectionForReadBase)

      Then in a future world with more catalog ops being LFR, AutoGetCollectionLFR would be used more.

      LFR helpers use shared_ptr<const Collection> and the rest use Collection*. This was my original problem, how to have a AutoGetCollectionForRead and AutoGetCollectionForReadLFR with one having a raw Collection* and the other a shared_ptr<const Collection>. Also need to tie in the soon to be lack of collection/db lock handling, and therefore removal of some checks, in the helper internals.

      AutoGetCollectionForRead uses a AutoGetCollection that does a bunch of locking stuff. An AutoGetCollectionForReadLFR still needs the logic AutoGetCollectionForRead implements, but doesn't want the same logic AutoGetCollectionBase implements.

            dianna.hohensee@mongodb.com Dianna Hohensee (Inactive)
            dianna.hohensee@mongodb.com Dianna Hohensee (Inactive)
            0 Vote for this issue
            1 Start watching this issue