[SERVER-41041] ViewCatalog should actively reload after changes Created: 07/May/19  Updated: 29/Oct/23  Resolved: 15/Jul/19

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 4.2.0-rc3, 4.3.1

Type: Bug Priority: Major - P3
Reporter: Xiangyu Yao (Inactive) Assignee: Gregory Wlodarek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Duplicate
is duplicated by SERVER-41011 Server may crash when running $where ... Closed
Related
related to SERVER-41011 Server may crash when running $where ... Closed
is related to SERVER-36816 Avoid reloading the view catalog on t... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.2
Steps To Reproduce:

Just increase the number of iterations:

+++ b/jstests/concurrency/fsm_workloads/view_catalog.js
@@ -94,7 +94,7 @@ var $config = (function() {
 
     return {
         threadCount: 5,
-        iterations: 5,
+        iterations: 100,
         data: data,
         setup: setup,
         states: states,

and then run

python buildscripts/resmoke.py -numClientsPerFixture 20 --suites=concurrency_simultaneous jstests/concurrency/fsm_workloads/view_catalog_direct_system_writes.js

Sprint: Execution Team 2019-06-03, Execution Team 2019-06-17, Execution Team 2019-07-15
Participants:
Linked BF Score: 15

 Description   

Currently any changes made to ViewCatalog or system.views collection only mark view catalog as invalid and it will lazily reload when later used. However, lazy reload may read outdated data from system.views and thus load wrong version of view catalog.

To fix this problem, we should always actively reload the view catalog by changing invalidate() function to an active reload function. We also need to set minVisibleSnapshot on the view catalog when reload. Any operations to view catalog will get a writeConflictException if it's behind the minVisibleSnapshot and then retry with a more up-to-date snapshot.



 Comments   
Comment by Githook User [ 13/Oct/20 ]

Author:

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

Message: SERVER-51320 Remove CollectionLock to system.views from functions in ViewCatalog.

They are not needed after the work in SERVER-41041.
Branch: master
https://github.com/mongodb/mongo/commit/ded7b44e03b6aea749c764d0e4cc2556785b4eb4

Comment by Githook User [ 17/Jul/19 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-41041 ViewCatalog should actively reload after changes

(cherry picked from commit 71fced4ef1bdbc1e5b517057eb15be256eaf0ba7)
Branch: v4.2
https://github.com/mongodb/mongo/commit/7deeff3a5046e66d63ed91ca7d5766024e20f552

Comment by Githook User [ 15/Jul/19 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-41041 ViewCatalog should actively reload after changes
Branch: master
https://github.com/mongodb/mongo/commit/71fced4ef1bdbc1e5b517057eb15be256eaf0ba7

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