[SERVER-51091] Rearrange lock helper (AutoGetCollection*) templating and inheritance to have AutoGetCollection and AutoGetCollectionLFR bases Created: 22/Sep/20  Updated: 29/Oct/23  Resolved: 30/Sep/20

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 4.8.0

Type: Task Priority: Major - P3
Reporter: Dianna Hohensee (Inactive) Assignee: Dianna Hohensee (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-51187 Yield/restore on CollectionPtr in a l... Closed
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2020-10-05
Participants:

 Description   

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.



 Comments   
Comment by Githook User [ 30/Sep/20 ]

Author:

{'name': 'Dianna Hohensee', 'email': 'dianna.hohensee@mongodb.com', 'username': 'DiannaHohensee'}

Message: SERVER-51091 Rearrange AutoGetCollection templating and inheritance to have separate -LFR and non-LFR (lock-free read) lock helpers.
Branch: master
https://github.com/mongodb/mongo/commit/3b8dfefeb9809a826354460b653b9d964730a18a

Generated at Thu Feb 08 05:24:28 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.