Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-40647

ViewCatalog::iterate should use _reloadIfNeeded rather than _requireValidCatalog

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 4.1.11
    • None
    • Storage
    • None
    • Fully Compatible
    • ALL
    • Hide

      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

      Show
      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
    • Storage NYC 2019-04-22
    • 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.

      Attachments

        Activity

          People

            xiangyu.yao@mongodb.com Xiangyu Yao (Inactive)
            xiangyu.yao@mongodb.com Xiangyu Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: