[ESQL] Adds memory accounting to GroupedLimitOperator#143941
[ESQL] Adds memory accounting to GroupedLimitOperator#143941ncordon merged 3 commits intoelastic:mainfrom
Conversation
586c7d3 to
eb368e2
Compare
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
There was a problem hiding this comment.
Pull request overview
This PR adds memory accounting visibility to GroupedLimitOperator by implementing Accountable and surfacing the operator’s retained memory usage in its status output (including an additional human-readable field).
Changes:
- Make
GroupedLimitOperatorimplementAccountableand reportramBytesUsed(). - Extend
GroupedLimitOperator.Statusto includeram_bytes_usedandram_usedintoXContent. - Update operator string/description outputs and corresponding unit tests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/GroupedLimitOperator.java | Adds Accountable implementation, updates describe()/toString(), and extends status with RAM usage fields. |
| x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/GroupedLimitOperatorTests.java | Updates expected describe()/toString() and asserts new RAM fields appear in status maps. |
| x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/GroupedLimitOperatorStatusTests.java | Updates wire/XContent expectations and mutation coverage for the new ramBytesUsed field. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -229,6 +252,7 @@ protected Status(StreamInput in) throws IOException { | |||
| pagesProcessed = in.readVInt(); | |||
| rowsReceived = in.readVLong(); | |||
| rowsEmitted = in.readVLong(); | |||
| ramBytesUsed = in.readVLong(); | |||
| } | |||
|
|
|||
| @Override | |||
| @@ -238,6 +262,7 @@ public void writeTo(StreamOutput out) throws IOException { | |||
| out.writeVInt(pagesProcessed); | |||
| out.writeVLong(rowsReceived); | |||
| out.writeVLong(rowsEmitted); | |||
| out.writeVLong(ramBytesUsed); | |||
| } | |||
There was a problem hiding this comment.
GroupedLimitOperator.Status adds ramBytesUsed to the wire format unconditionally (readVLong/writeVLong). This breaks BWC for mixed-version clusters because older nodes will attempt to deserialize the status without this extra field. Gate the new field behind a TransportVersion feature flag (and default ramBytesUsed to 0 when unsupported), similar to HashAggregationOperator.Status / TopNOperatorStatus.
There was a problem hiding this comment.
I think there's no need for TV, as this status is never used yet (Not linked with the planning). But it's maybe worth an extra opinion here
There was a problem hiding this comment.
Not true because this operator is not in use yet
…elocations * upstream/main: (54 commits) [ES|QL|DS] Wire parallel parsing into production for text formats (elastic#143997) ESQL: Allow EXTERNAL commands be run part of the CsvTests suite (elastic#143970) [ESQL] Push stats to external source via metadata (elastic#143940) Mute org.elasticsearch.xpack.esql.CsvIT test {csv-spec:approximation.Approximate stats with stats where} elastic#144051 Refactored SortedNumericDocValuesSyntheticFieldLoader into a Layer (elastic#143912) Enable extended doc_values params feature flag in RandomizedRollingUpgradeIT (elastic#143918) Mute org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT test {csv-spec:approximation.Approximate stats with sample} elastic#144022 Ensure we use float values for rolling upgrade float vectors (elastic#144032) Remove sensitive info from reindex task description (elastic#143635) Fix HistogramUnionState.equals (elastic#143990) Use dedicated IndexRouting API in ShardSplittingQuery (elastic#143776) Engine/Store DistributedArchitectureGuide doc (elastic#143818) Mute org.elasticsearch.snapshots.ConcurrentSnapshotsIT testDeletesAreBatched elastic#144034 Avoid serializing exceptions as JSON in remote write endpoint (elastic#143987) allow testLoadDocSequenceReturnsCorrectResultsText to circuit break, it happens in serverless occasionally (elastic#144023) [ESQL] Adds memory accounting to GroupedLimitOperator (elastic#143941) Adjust ESIntegTestCase.getLiveDocs method to account for pruned sequence numbers (elastic#143999) Support target bucket count in `TBUCKET` with explicit from/to date range (elastic#142747) TSDBDocValuesFormatSingleNodeTests with and without synthetic id (elastic#144002) Fix circuit breaker leak in BreakingTDigestHolder (elastic#143873) ...
Given
GroupedLimitOperatorstoresseenKeys,countsand whatnot and it's not just a pass-through page operator, this PR makes it implementAccountableso we have some visibility into the memory consumption of the operator.Part of #112918, https://github.com/elastic/esql-planning/issues/238