[SERVER-25569] Iterating through ViewCatalog must be done under the mutex Created: 11/Aug/16  Updated: 11/Oct/16  Resolved: 19/Aug/16

Status: Closed
Project: Core Server
Component/s: Internal Code, Querying
Affects Version/s: 3.3.10
Fix Version/s: 3.3.12

Type: Bug Priority: Major - P3
Reporter: Kyle Suarez Assignee: Kyle Suarez
Resolution: Done Votes: 0
Labels: read-only-views
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Integration 2016-08-29
Participants:
Linked BF Score: 0

 Description   

After this commit, it is no longer permissible to expose the ViewMap's begin() and end() iterators to external users. Because no mutex is held, the catalog's map may change at any time, invalidating the iterators. Instead, we should create an iterate() method that accepts a callback, and iterate through the ViewMap under the protection of the catalog's mutex.

In addition, we should call reloadIfNeeded() before beginning the iteration to sync with any changes to system.views.

Original Description

listCollections does not refresh the ViewCatalog before iterating through it, meaning that it won't be updated even if a change to system.views would have marked it as invalid.



 Comments   
Comment by Githook User [ 19/Aug/16 ]

Author:

{u'username': u'ksuarz', u'name': u'Kyle Suarez', u'email': u'kyle.suarez@mongodb.com'}

Message: SERVER-25569 Must hold mutex when iterating through ViewCatalog

Replaces ViewCatalog::begin()/::end() with a thread-safe iterate() method.
Branch: master
https://github.com/mongodb/mongo/commit/be6868e2fd72522faa4250145e85aec1e0da6d0c

Generated at Thu Feb 08 04:09:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.