[SERVER-55280] Change the locked AutoGetCollection* helpers to use a shared_ptr<const Collection>, as the lock-free versions, to simplify code Created: 17/Mar/21  Updated: 29/Oct/23  Resolved: 02/Mar/23

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 7.0.0-rc0

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

Issue Links:
Duplicate
is duplicated by SERVER-65011 Merge CollectionCatalog::lookupCollec... Closed
Assigned Teams:
Storage Execution
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2023-03-06
Participants:

 Description   

TLDR; this is an attempt to simplify the collection helper code by consolidating underlying raw point and shared pointer to Collection instances to all be shared pointers.

My targeted goal is to eliminate this type handling wherein the function return type is extracted from a function parameter. There are many changes that would be required to do this, and, if they work, would simplify other code complicated by juggling two possible Collection pointer types (raw pointer and shared_ptr).

These are some points in the code of interest to eliminate

I'd like to simplify CollectionPtr as well, which currently handles both raw and shared Collection pointer types.



 Comments   
Comment by Githook User [ 02/Mar/23 ]

Author:

{'name': 'Henrik Edin', 'email': 'henrik.edin@mongodb.com', 'username': 'henrikedin'}

Message: SERVER-55280 Remove the interface that returns Collection as shared_ptr from CollectionCatalog

Cleanup and clarify requirements for Collection instances to remain valid in CollectionCatalog header
Branch: master
https://github.com/mongodb/mongo/commit/7a80f01c3a56292904a87856ea60124beab5c44a

Comment by Henrik Edin [ 23/Sep/22 ]

dianna.hohensee@mongodb.com I think we should be able to remove shared_ptr from the interfaces and only expose raw pointers. The lifetimes should be managed by either stashing a catalog or in a decoration on the recovery unit for uncommitted read/write instances.

Comment by Dianna Hohensee (Inactive) [ 22/Sep/22 ]

henrik.edin@mongodb.com would we want this to be an underlying Collection* at this point, rather than a shared_ptr<const Collection>? Since LFR AGC* hold a catalog copy, and locked AGC* hold collection IX locks.

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