[SERVER-50983] Add mode to AutoGetCollection to create collection if it doesn't exist Created: 16/Sep/20  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Henrik Edin Assignee: Backlog - Storage Execution Team
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-50984 Make query yielding aware of AutoGetC... Closed
Assigned Teams:
Storage Execution
Participants:

 Description   

There is an ensureDb() function but no equivalent to ensureCollection.

There are workarounds being used throughout the code to wrap the AutoGetCollection in a boost::optional to be able to re-construct it after the collection has been created.

Other places just uses the raw Collection* from the AutoGetCollection so it can be set to a newly created Collection and the AutoGetCollection is just used to hold the locks in that case.

With lock free reads the latter approach could be dangerous as the extracted Collection pointer may dangle after a writable collection is requested or we yield inside query.

A new flag to AutoGetCollection to create collections if not existing could streamline and simplify code in many places.


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