Skip to content

fix(pubsub): publish messages larger than the configured batch threshold#4822

Merged
PhongChuong merged 2 commits intogoogleapis:mainfrom
PhongChuong:ExceededByteThresholdError
Feb 26, 2026
Merged

fix(pubsub): publish messages larger than the configured batch threshold#4822
PhongChuong merged 2 commits intogoogleapis:mainfrom
PhongChuong:ExceededByteThresholdError

Conversation

@PhongChuong
Copy link
Copy Markdown
Collaborator

@PhongChuong PhongChuong commented Feb 25, 2026

This PR removes the ExceededByteThresholdError. The Publisher now sends the messages that are larger than the configured batch threshold in its own batch. For messages that are larger than the server message size limit, the Publisher will send the message and return the server side error message to the application. Similar to other server errors, if and only if the message have an ordering key, then we pause Publishing for that key.

This also remove the publisher_publish_msg_too_big test for Publisher as the case is handled the same way as any other server side error.

Fixes #4650

@product-auto-label product-auto-label bot added the api: pubsub Issues related to the Pub/Sub API. label Feb 25, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.96%. Comparing base (fc45945) to head (e5076fe).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4822      +/-   ##
==========================================
+ Coverage   94.94%   94.96%   +0.01%     
==========================================
  Files         205      205              
  Lines        8059     8047      -12     
==========================================
- Hits         7652     7642      -10     
+ Misses        407      405       -2     

☔ 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.

@PhongChuong PhongChuong marked this pull request as ready for review February 25, 2026 18:52
@PhongChuong PhongChuong requested a review from a team as a code owner February 25, 2026 18:52
Copy link
Copy Markdown
Collaborator

@suzmue suzmue left a comment

Choose a reason for hiding this comment

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

Can you please add a test that covers this case?

Reading the code it doesn't seem like this will actually add the too big message to a batch. Doesn't can_add always return false so it just tries flush the empty batch? Even if so, I'd like to see a test to check the behavior.

@PhongChuong
Copy link
Copy Markdown
Collaborator Author

@suzmue , added the tests. Good catch on the sequential actor empty message issue. PTAL.

@PhongChuong PhongChuong force-pushed the ExceededByteThresholdError branch from 6f8f8ef to e5076fe Compare February 26, 2026 18:01
@PhongChuong PhongChuong merged commit aaa316f into googleapis:main Feb 26, 2026
35 checks passed
@PhongChuong PhongChuong deleted the ExceededByteThresholdError branch February 27, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: pubsub Issues related to the Pub/Sub API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pubsub should return error when Publish message size is larger than batch threshold

2 participants