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

Throw ErrorCode::QueryPlanKilled for stale index views during stale cached replans

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • Fully Compatible
    • QE 2024-03-18, QE 2024-04-01
    • 144

      Normally, locks are held when acquiring a CollectionPtr, but these are dropped when yielding:

      /**
       * Smart-pointer'esque type to handle yielding of Collection lock that may invalidate pointers when
       * resuming. CollectionPtr will re-load the Collection from the Catalog when restoring from a yield
       * that dropped locks.
       */ 

      Cached plans require a trial period of executing the plan, which could imply yielding. These yields then cause the locks to be released, and could allow for a dropIndex command to be interleaved. 

      Normally when this happens, the query should killed with a QueryPlanKilled exception:

          auto desc = collectionPtr()->getIndexCatalog()->findIndexByIdent(expCtx()->opCtx, _indexIdent);
          uassert(ErrorCodes::QueryPlanKilled,
                  str::stream() << "query plan killed :: index '" << _indexName << "' dropped",
                  desc); 

      This is fixes the scenarios discovered in BF-32193 and BF-32233.

            Assignee:
            catalin.sumanaru@mongodb.com Catalin Sumanaru
            Reporter:
            catalin.sumanaru@mongodb.com Catalin Sumanaru
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: