[Rust] Enforce 10 MiB client-side payload limit on ingest calls#331
Open
elenagaljak-db wants to merge 2 commits into
Open
[Rust] Enforce 10 MiB client-side payload limit on ingest calls#331elenagaljak-db wants to merge 2 commits into
elenagaljak-db wants to merge 2 commits into
Conversation
Signed-off-by: elenagaljak-db <elena.galjak@databricks.com>
6e3f13e to
78da598
Compare
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.
What changes are proposed in this pull request?
Enforce the Zerobus server's 10 MiB payload limit client-side on
ingest_record_offsetandingest_records_offset. Without this, an oversized payload travels through the landing zone and gRPC layer before being rejected by the server. With this change, the SDK returnsZerobusError::InvalidArgumentimmediately, before any network I/O.The limit applies to the total encoded byte size of a single call (sum of all record bytes in the batch). It does not apply to Arrow Flight (
ingest_batch/ingest_ipc_batch), which has a separate code path.Perf impact: measured with Criterion: the check costs ~3 ns for a single record and ~20 ns for a 100-record batch (reading
.len()from aSmallVec, no allocation). Well within the noise of the mutex + gRPC overhead.Changes
sdk/src/lib.rs— module-levelMAX_INGEST_PAYLOAD_BYTESconstant (10 MiB) with a note that it mirrors the server limit; check at the top ofingest_internal_v2sdk/src/record_types.rs—EncodedBatch::total_byte_size()(pub) + unit teststests/src/rust_tests.rs— integration tests for single-record and batch rejectionREADME.md— new "Payload Size Limit" subsection under Error HandlingNEXT_CHANGELOG.md— entry under New Features and ImprovementsHow is this tested?
cargo test --workspace