You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Account for full protobuf size when batching topic writes - #929
Topic write batching counted payload bytes and a fixed overhead, so messages with metadata could be grouped into a request exceeding the gRPC size limit.
Build each message's protobuf representation once and pack it directly into requests using its serialized size. Include message metadata, transaction identity, and nested field framing in the size calculation, then pass the prepared protobuf requests to the stream without rebuilding them.
This pull request updates topic-writer batching to enforce the complete serialized protobuf request size, including metadata, transaction identity, and framing overhead.
Changes:
Replaces fixed-overhead estimation with protobuf-aware size calculations.
Adds boundary tests for metadata, transactions, framing, codecs, and oversized messages.
Documents the serialized-size batching behavior and records the fix in the changelog.
A critical issue remains: individually oversized messages can still be sent instead of being rejected with a terminal TopicWriterError.
File
Description
ydb/_topic_writer/topic_writer.py
Implements protobuf-size-based request splitting.
ydb/_topic_writer/topic_writer_test.py
Adds serialized-size and boundary-condition tests.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Oversized individual messages can still be appended and sent in requests exceeding the gRPC limit, potentially causing indefinite retries and blocking close().
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Reject oversized messages before appending to requests
ydb/_topic_writer/topic_writer.py:286
When a single serialized message is larger than the limit, this branch first emits the current request and then appends that message to a new request anyway. The resulting RPC is guaranteed to exceed the gRPC send limit, so the writer can still retry the oversized request indefinitely and leave close() waiting, which is the failure mode this change is intended to prevent. Detect an oversized message before appending it and fail the write with a terminal TopicWriterError (the new oversized-message test currently codifies sending an over-limit request).
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
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.
Topic write batching counted payload bytes and a fixed overhead, so messages with metadata could be grouped into a request exceeding the gRPC size limit.
Build each message's protobuf representation once and pack it directly into requests using its serialized size. Include message metadata, transaction identity, and nested field framing in the size calculation, then pass the prepared protobuf requests to the stream without rebuilding them.
Related to #930.