-
Type: Task
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Catalog and Routing
-
2
AutoGetCollection now has operators making it behave like a smart pointer.
With lock free reads it can be dangerous to call AutoGetCollection::getCollection and cache the returned pointer as a subsequent call to AutoGetCollection::getWritableCollection can invalidate the previous pointer.
We should use operator-> and operator* on the AutoGetCollection when possible to encapsulate the Collection lifetime within the AutoGetCollection.
While doing this we should also consider changing interfaces that pass along const Collection* to be const Collection&. That would make it clean to get the necessary type by just dereferencing the AutoGetCollection instance.
Also while we are in here: consider renaming AutoGetCollection::getCollection() to AutoGetCollection::get() to make the interface more consistent with unique and shared pointer. As it is a Collection RAII type, the default return should be a Collection.
- depends on
-
SERVER-67289 Remove Feature Flag for PM-2218
- Closed
- duplicates
-
SERVER-52880 Cleanup AutoGetCollection*** implementation and abstractions
- Closed