Do not hold replication mutex when calling getMinValid

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 3.6.7, 4.0.2, 4.1.2
    • Affects Version/s: None
    • Component/s: Replication
    • None
    • Fully Compatible
    • ALL
    • v4.0, v3.6
    • Repl 2018-08-13
    • 63
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      It is not valid to read collections while holding the replication mutex. The reason is that reading a collection takes the global lock, which may be held by another thread, and that thread may be waiting on the replication mutex (e.g. by calling getMyLastAppliedOpTime).

      Thus, _replicationProcess->getConsistencyMarkers->getMinValid must not be called with the replication mutex held, as it is in _finishLoadLocalConfig.

      I believe we may simply release the repl mutex before checking !lastOpTime.isNull()

      https://github.com/mongodb/mongo/blob/960fca37a78040d75d87f8049ef4c4a6227506cc/src/mongo/db/repl/replication_coordinator_impl.cpp#L598

      Then re-acquire after calling getMinValid() (and remove the else clause).

              Assignee:
              Tess Avitabile (Inactive)
              Reporter:
              Matthew Russotto
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: