Introduce a fixed-capacity RingBuffer container primitive

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 std::deque members, which allocate and free on each push/pop. Its buffers are bounded by the stage's configured limits, so a preallocated fixed-capacity ring buffer would avoid that per-element allocation churn on a hot path.

      Introduce a reusable, self-contained RingBuffer<T> primitive:

      • New module src/mongo/db/query/util/ring_buffer.h (+ BUILD.bazel target) with unit tests.
      • Fixed capacity set at construction; push / pop / front / size / empty by slot offset, no per-op allocation.
      • No production consumers in this ticket; the primitive lands and is unit-tested in isolation.

      Built primarily for BatchedEnrichmentStage (adoption tracked separately), but kept general so other bounded-buffer stages can reuse it.

      No behaviour change.

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

              Created:
              Updated: