[SERVER-40647] ViewCatalog::iterate should use _reloadIfNeeded rather than _requireValidCatalog Created: 15/Apr/19  Updated: 29/Oct/23  Resolved: 16/Apr/19

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

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

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

Increase the window between _reloadIfNeeded and _valid:

  179     void _requireValidCatalog(WithLock lk, OperationContext* opCtx) {                                                                                                                                                                                                               
  180         uassertStatusOK(_reloadIfNeeded(lk, opCtx));                                                                                                                                                                                                                                
+ 181         sleepsecs(2);                                                                                                                                                                                                                                                               
  182         invariant(_valid.load());                                                                                                                                                                                                                                                   
  183     }   

resmoke.py --suites concurrency --numClientsPerFixture 20 jstests/concurrency/fsm_workloads/view_catalog_direct_system_writes.js

Sprint: Storage NYC 2019-04-22
Participants:
Linked BF Score: 20

 Description   

When listCollections() calls viewCatalog::iterate, it's possible that there is a concurrent modification to "system.views" collection which invalidates the viewCatalog between viewCatalog's reload and invariant for _valid.

This function (and its invariant) is still meaningful for viewCatalog::create/update/drop because the collection lock should prevent such concurrent modification to "system.views". However, ViewCatalog::iterate does not have those locks so it shouldn't invariant that _valid is true after reload.



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

Author:

{'name': 'Xiangyu Yao', 'username': 'xy24', 'email': 'xiangyu.yao@mongodb.com'}

Message: SERVER-40647 ViewCatalog::iterate should use _reloadIfNeeded rather than _requireValidCatalog
Branch: master
https://github.com/mongodb/mongo/commit/6fd5b4d17b87aa652381fd28cefe2a7eb5ec8d5d

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