[SERVER-53057] Make ViewCatalog copy-on-write Created: 24/Nov/20  Updated: 29/Oct/23  Resolved: 10/Dec/20

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

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:
Depends
is depended on by SERVER-52559 Resolving namespace in aggregation sh... Closed
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2020-12-14
Participants:

 Description   

SERVER-52559 needs to make this lock lock-free, but the db.system.views collection lock is currently taken to avoid cycles in view definition resolution: i.e. allowing views to continue to be created or modified during aggregation pipeline view definition resolution can lead to an endless cycle.

A way to resolve SERVER-52559's issue is to make the ViewCatalog copy-on-write. Lock-free reads already fetch shared_ptr<ViewCatalog> in order to avoid the ViewCatalog destructing during lock-free operation. This change would make the ViewCatalog immutable for lock-free reads.



 Comments   
Comment by Githook User [ 09/Dec/20 ]

Author:

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

Message: SERVER-53057 Read-copy-update for the ViewCatalog.

get() now returns an immutable instance.
Modifications are done with static functions in the ViewCatalog that perform the update serialized by a write mutex.

Const-correct usage of the ViewCatalog.
Branch: master
https://github.com/mongodb/mongo/commit/c7692fcb55476c5b7d1f17f10662935255637012

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