Skip to content

Add REST write request size and batch limits#17481

Open
HTHou wants to merge 2 commits intomasterfrom
codex/rest-api
Open

Add REST write request size and batch limits#17481
HTHou wants to merge 2 commits intomasterfrom
codex/rest-api

Conversation

@HTHou
Copy link
Copy Markdown
Contributor

@HTHou HTHou commented Apr 15, 2026

Summary

  • add configurable REST request limits for body size, row count, column count, and total values
  • reject oversized request bodies early with a pre-matching filter and return HTTP 413 for limit violations
  • enforce write batch limits across REST v1, v2, and table APIs during request validation
  • update REST exception handling to preserve 413 responses instead of always returning HTTP 200
  • document the new REST configuration properties in system property templates and test resources

Testing

  • Not run (not requested)

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
18.9% Duplication on New Code (required ≤ 5%)

See analysis details on SonarQube Cloud

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

❌ Patch coverage is 19.69697% with 159 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.59%. Comparing base (d245edc) to head (39b16b8).
⚠️ Report is 16 commits behind head on master.

Files with missing lines Patch % Lines
...b/rest/protocol/filter/RequestSizeLimitFilter.java 0.00% 30 Missing ⚠️
.../protocol/v2/handler/RequestValidationHandler.java 42.85% 16 Missing ⚠️
...che/iotdb/db/conf/rest/IoTDBRestServiceConfig.java 0.00% 16 Missing ⚠️
...iotdb/db/conf/rest/IoTDBRestServiceDescriptor.java 0.00% 16 Missing ⚠️
...otdb/rest/protocol/v2/impl/RestApiServiceImpl.java 0.00% 15 Missing ⚠️
...est/protocol/table/v1/impl/RestApiServiceImpl.java 0.00% 12 Missing ⚠️
.../protocol/v1/handler/RequestValidationHandler.java 40.00% 9 Missing ⚠️
...b/rest/protocol/v1/impl/GrafanaApiServiceImpl.java 0.00% 9 Missing ⚠️
...otdb/rest/protocol/v1/impl/RestApiServiceImpl.java 0.00% 9 Missing ⚠️
...b/rest/protocol/v2/impl/GrafanaApiServiceImpl.java 0.00% 9 Missing ⚠️
... and 5 more
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #17481      +/-   ##
============================================
- Coverage     39.83%   39.59%   -0.24%     
- Complexity      312      324      +12     
============================================
  Files          5135     5168      +33     
  Lines        347075   349305    +2230     
  Branches      44221    44606     +385     
============================================
+ Hits         138249   138310      +61     
- Misses       208826   210995    +2169     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +57 to +68
org.apache.iotdb.rest.protocol.v1.model.InsertTabletRequest request =
new org.apache.iotdb.rest.protocol.v1.model.InsertTabletRequest();
request.setDeviceId("root.sg.d1");
request.setIsAligned(false);
request.setMeasurements(Collections.singletonList("s1"));
request.setDataTypes(Collections.singletonList("INT64"));
request.setTimestamps(Arrays.asList(1L, 2L, 3L));
request.setValues(Collections.singletonList(Arrays.asList(1L, 2L, 3L)));

org.apache.iotdb.rest.protocol.v1.handler.RequestValidationHandler.validateInsertTabletRequest(
request);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to use short names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants