[To dev/1.3] Enforce REST query row limit as hard cap (#18149)#18197
Merged
Conversation
…n tests A non-positive rest_query_default_row_size_limit used to mean "unlimited"; the hard-cap handling clamped it down to 1, silently capping every REST response to a single row. Remap non-positive values to the built-in default (10000) so existing deployments are not degraded, while still guaranteeing a finite cap. Add regression coverage: - QueryRowLimitUtilsTest: an oversized caller-provided rowLimit is clamped to the configured hard limit. - FastLastHandlerTest: the fastLastQuery cache-hit path caps the number of materialized entries. The cache-hit loop is extracted into FastLastHandler.fillLastValueDataSet so it is unit-testable.
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev/1.3 #18197 +/- ##
=============================================
- Coverage 43.54% 43.53% -0.01%
Complexity 198 198
=============================================
Files 3630 3631 +1
Lines 243741 243791 +50
Branches 29741 29753 +12
=============================================
+ Hits 106127 106141 +14
- Misses 137614 137650 +36 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
Backport #18149 to
dev/1.3.Enforce the configured REST response limit
rest_query_default_row_size_limitas a hard upper bound for REST v1/v2 query responses.rowLimit/row_limitto the configured limit.Cover Grafana and fast-last paths
QueryRowLimitUtils.dev/1.3 adaptations
The original PR targets the newer standalone REST module. This backport preserves the
dev/1.3layout and APIs:iotdb-core/datanode,org.apache.iotdb.db.protocol.rest.*, andjavax.ws.rs.Map<PartialPath, Map<String, TimeValuePair>>.dev/1.3.Validation
mvn spotless:apply -pl iotdb-core/datanodemvn -q clean test -pl iotdb-core/datanode -am -Dtest=QueryRowLimitUtilsTest,QueryDataSetHandlerTest,FastLastHandlerTest -Dsurefire.failIfNoSpecifiedTests=falsegit diff --check origin/dev/1.3...HEADThis PR has:
Key changed/added classes
QueryRowLimitUtilsQueryDataSetHandlerRestApiServiceImplGrafanaApiServiceImplFastLastHandler