Use RingBuffer for BatchedEnrichmentStage input/output buffers

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      BatchedEnrichmentStage buffers events in two std::deque members (the pre-enrichment input buffer and the enriched output buffer). Both are bounded by the stage's configured limits (max input events and max output bytes), so they can use a fixed-capacity ring buffer instead of a std::deque that reallocates on every push/pop. Change-stream and $search enrichment is a hot path, so cutting that allocation churn is worthwhile.

      Replace the two std::deque members in src/mongo/db/exec/agg/batched_enrichment_stage.h with the RingBuffer primitive, sizing capacity from the stage's limits.

      Behaviour-preserving: the existing BatchedEnrichmentStageTest suite is the regression bar.

      Depends on SERVER-129348 (the RingBuffer primitive).

            Assignee:
            Denis Grebennicov
            Reporter:
            Denis Grebennicov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: