[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: |
|
||||||||
| 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 DescriptionlistCollections 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: Replaces ViewCatalog::begin()/::end() with a thread-safe iterate() method. |