-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(pubsub): include request overhead when computing publish batch size overflow #9911
Conversation
The maximum allowed size for a PublishRequest on the backend is lower than a mere sum of the byte sizes of individual messages. This commit adjusts the batch size overflow calculation to account for this overhead. It also caps the effective maximum BatchSetting.max_size value to 10_000_000 bytes (the limit on the backend). (credit also to GitHub @relud for outlining the main idea first in the issue description)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Judgement call on your part to make a distinct exception class for test_publish_single_message_size_exceeeds_server_size_limit
or leave as is, otherwise LGTM.
@software-dov Thanks for the quick review, addressed the last outstanding comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #7108.
This PR fixes the logic that computes the publish batch size overflow, taking the total request message size overhead into account. The improved logic prevents the server-side errors simular to the following:
How to test
(see also the system test in this PR)
BatchSettings.max_bytes
substantially larger than 10_000_000, andBatchSettings.max_latency
to one second (so that the publish autocommit does not kick in too soon).Actual result (before the fix):
The backend responds with a "400 InvalidArgument" error.
Expected result (after the fix):
All messages are successfully published (the code splits them into multiple publish batches).
PR checklist