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

Race in catalog cache loader

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.8
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Fully Compatible
    • ALL
    • 17

      In CatalogCache::checkEpochOrThrow() we check if there pointer to routingInfo associated with a collection is non-null.

      In _scheduleCollectionRefresh() (which may run at the same time as a call to checkEpochOrThrow()), we std::move() from collEntry->routingInfo. See here. (Keep in mind that std::move()ing from a shared pointer will "transfer" the reference count to the left hand side, and set the right hand side to nullptr).

      The routingInfo is reset once the refresh has completed here. This means that in the period during which the refresh is happening (after we've scheduled the refresh, dropped the mutex, and are waiting for the background thread here), the collection's routingInfo will be nullptr, so it will appear to be unsharded.

            Assignee:
            ian.boros@mongodb.com Ian Boros
            Reporter:
            ian.boros@mongodb.com Ian Boros
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: