Fix graphLookup infinite recursion in LiteParsed

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.0.0-rc1
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Integration
    • Fully Compatible
    • 200
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Fix infinite recursion in `resolveInvolvedNamespacesImpl` when two views mutually reference each
      other via `$graphLookup` (or bare `$unionWith` / equality-style `$lookup`).

      *Root cause*: `materializeViewSubpipeline()` creates the sub-pipeline with the backing-collection
      NSS as `_originalParseNss`. The `inProgress` cycle-detection guard in `resolveSubpipelinesInRange`
      was gated on `isView(subNss)`, which returns false for the backing collection, causing infinite
      recursion on mutual view cycles.

      *Fix*: Tag each materialized `OwnedLiteParsedPipeline` with the originating view NSS via
      `setViewNssForCycleDetection()`. The resolver uses that NSS (falling back to `subNss`) for the
      `inProgress` guard, so cycles are detected correctly regardless of which NSS the pipeline was
      parsed under.

      Also converts `MONGO_UNREACHABLE_TASSERT(12511900)` in `GraphLookUpStage::makePipeline()` to a
      `uasserted(ErrorCodes::CollectionBecameView)` so the exhausted-retry-loop case is retriable rather
      than a server crash.

            Assignee:
            Mariano Shaar
            Reporter:
            Mariano Shaar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: