Repository navigation
Description
Found by claude-review on PR #7720 (issue #7663).
Summary
#7663 gave the Grafana aggregation branch the hard row ceiling it never consulted, but the ceiling is
enforced on the RESULT, not on the work:
final MultiColumnAggregationResult aggResult = engine.aggregateMulti(fromTs, toTs, requests, bucketInterval, tagFilter);
final List<Long> timestamps = aggResult.getBucketTimestamps();
if (!budget.charge(timestamps.size()))
throw resultSetTooLarge(budget.ceiling());aggregateMulti visits the whole range to fill the buckets it returns, so a request with a small
bucketInterval over a wide range pays the full scan and the full bucket allocation, and is THEN refused.
The refusal bounds the response; it does not bound the cost of producing it.
PostTimeSeriesQueryHandler.executeAggregation has the identical shape, and so does the gRPC
aggregated path's ceiling (#7390) - all three charge after the fact.
Why it was out of scope for #7663
#7663 is the row-cap push-down: a read carrying a row bound must bound its FETCH by it. A bucket count is
a different bound with a different mechanism - the row count of the answer is not the row count of the
input, and aggregateMulti has no limit parameter to push anything into. Adding one is a change to the
aggregation engine and its shard merge (MultiColumnAggregationResult.mergeFrom), not to the handlers,
and it needs its own test for what a partially-filled bucket set means.
The raw branches of all three surfaces ARE now bounded in the fetch; this is the aggregated half.
Consequence
The ceiling stops an oversized RESPONSE, which is what #5719 asked of it. It does not stop an operator
(or a dashboard auto-refreshing every 5s with a one-millisecond bucketInterval) from making the server
do the whole scan repeatedly and throw the result away. The cheapest shape of the request is the one the
ceiling already recognises as abusive.
Suggested fix
The bucket count is knowable BEFORE the scan whenever the range and the interval are both bounded:
(toTs - fromTs) / bucketInterval + 1. Refusing on that arithmetic, before calling aggregateMulti,
costs nothing and turns the refusal from O(range) into O(1). An unbounded range (Long.MIN_VALUE to
Long.MAX_VALUE) cannot be pre-computed that way and would keep the after-the-fact check.
Apply it to all three: PostGrafanaQueryHandler.executeAggregation,
PostTimeSeriesQueryHandler.executeAggregation, and the gRPC bucket-streaming ceiling.
Verification
- A request whose bucket count exceeds the ceiling over a WIDE range is refused without the scan -
assert withAggregationMetricsthat no block was touched. - The existing ceiling tests stay green, in particular
Issue7663GrafanaPrometheusRowCeilingIT.theGrafanaAggregationBranchIsBoundedByTheSameCeilingand
Issue7390GrpcTimeSeriesRowCeilingIT.theAggregatedPathUsesTheSameCeiling: the refusal and its wording
are unchanged, only its cost.
Activity
fix(#7724): say what the multi-shard bucket bound is, and pin the merge
Merge branch 'main' into fix/issue-7725-7724-7722-7717-7716-batch
fix(#7717): count the aggregation's mutable half too, closing the las…
test(#7724): pin how far past the ceiling the mutable walk actually goes
Merge pull request #7728 from ArcadeData/fix/issue-7725-7724-7722-771…
lvca commentedon Sep 16, 2026
Fixed in #7728, released in 26.10.1.
A time-series aggregation that asks for more buckets than a single response may carry is refused. Until now the server produced the whole answer first and then threw it away, so the cheapest way to make it do a lot of work was to send a request it was always going to reject - a small
bucketIntervalover a wide range, which a dashboard on a short refresh interval can repeat every few seconds.The limit is now applied while the data is being read: the scan stops as soon as the answer is known to be too large. The refusal itself is unchanged - same status, same message naming the setting that decided - only its cost.
This applies to
/api/v1/ts/{database}/query, the Grafana query route, and the gRPC bucket stream. Requests that fit within the limit are unaffected.❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
fix: batch of 5 TimeSeries read-path issues (ArcadeData#7725, ArcadeD…