Fix DPL callback loss in $_internalDocumentResultsAndMetadata when expanded via LiteParsed desugar path

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Integration
    • Fully Compatible
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When featureFlagExtensionsInsideHybridSearch is enabled, the router expands extensions through the LiteParsed desugar path (DocumentSourceExtensionOptimizable::LiteParsedExpandable::expandImpl). On this path the stage is rebuilt from BSON via StageParams, meaning the ShardedPlanProvider cannot survive a BSON round-trip and is silently dropped.

      distributedPlanLogic() then bails at the _shardedPlanProvider null check and returns boost::none, so the split machinery treats DRM like any ordinary stage: no merge-sort on the router, $$SEARCH_META bound per-shard to each shard's local metadata, and the metadata merge pipeline never executed.

      A second related gap: DRM had no clone() override, so even when the provider was attached via the other expansion path, it would not survive the Pipeline::clone() call the mongos explain path makes before splitting.

      Fix: Carry the provider in-memory through the layers the pipeline actually traverses:

      • Move DocResultsShardedPlanSpec/Provider types to lite_parsed_internal_document_results_and_metadata.h (the DS header includes this one) so both InternalDocumentResultsAndMetadataLiteParsed and StageParams can hold the provider.
      • Add a DocumentResultsAndMetadataAstNode::expandToLiteParsed() override that stashes the provider on the lite-parsed object. The wrapping lambda is shared with the existing path via makeShardedPlanProvider(). expandToLiteParsed() is made virtual in ast_node.h.
      • createFromStageParams() attaches the provider to the constructed stage.
      • Add a clone() override that re-attaches the provider after the default BSON-round-trip clone.

            Assignee:
            Daniel Segel
            Reporter:
            Daniel Segel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: