[SERVER-50984] Make query yielding aware of AutoGetCollection at high level Created: 16/Sep/20  Updated: 29/Oct/23  Resolved: 28/Sep/20

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

Type: Task Priority: Major - P3
Reporter: Henrik Edin 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-50145 Have DDL operations and MODE_X writer... Closed
Related
related to SERVER-50983 Add mode to AutoGetCollection to crea... Backlog
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2020-09-21, Execution Team 2020-10-05
Participants:

 Description   

With lock free reads, restoring locks and state after query yielding may cause Collection pointers held by AutoGetCollection and other helpers at a high level to be invalid and dangle.

There might have come a MODE_X writer that installed a new Collection instance into the Collection catalog during the window where yield had the locks released.

We need to add a way to pass any AutoGetCollection instances to the query plan executor so they can be notified to refresh their state when we restore after yield.



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

Author:

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

Message: SERVER-50984 Add CollectionPtr to replace usage of const Collection*

It implements a yieldable interface that is used to re-load the
Collection pointer from the catalog after a yield that released locks.
With lock-free reads and copy-on-write on Collection instances releasing
locks without notifying an AutoGetCollection at a higher level may cause
its pointers to dangle if a MODE_X writer installs a new Collection
instance in the catalog.

CollectionPtr should be passed by const reference so a yield can notify
all the way up.
Branch: master
https://github.com/mongodb/mongo/commit/2b82ab88982566114d1bb7667477b71c883b0799

Comment by Githook User [ 26/Sep/20 ]

Author:

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

Message: SERVER-50984 Add CollectionPtr to replace usage of const Collection*
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/64d58988a23e73fc7ee687c5b54fa2af1a6c5647

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