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

ViewCatalog::iterate should use _reloadIfNeeded rather than _requireValidCatalog

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.11
    • Affects Version/s: None
    • Component/s: Storage
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Hide

      Increase the window between _reloadIfNeeded and _valid:

      Unable to find source-code formatter for language: c++. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
        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: Unable to find source-code formatter for language: c++. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml 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

      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.

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

              Created:
              Updated:
              Resolved: