Skip to content

fix(bigtable): Added rst_stream exception handling for ReadRows. - #18197

Open
daniel-sanche wants to merge 3 commits into
shim/09-read-rows-row-setfrom
shim/10-read-rows-rst-stream
Open

fix(bigtable): Added rst_stream exception handling for ReadRows.#18197
daniel-sanche wants to merge 3 commits into
shim/09-read-rows-row-setfrom
shim/10-read-rows-rst-stream

Conversation

@daniel-sanche

Copy link
Copy Markdown
Contributor

Migrating over @gkevinzheng PR from bigtable monorepo googleapis/python-bigtable#1298

Original description:

According to go/rst_stream, INTERNAL errors with error messages related to an rst_stream error should be interpreted as UNAVAILABLE errors instead of internal errors. This PR creates a custom retry predicate to allow retrying of INTERNAL errors with rst_stream specific error messages if the ServiceUnavailable exception is allowed to be retried.

Note to reviewers: This PR has already been reviewed and merged to a staging branch, with the intention of doing a single merge to main. We are now planning to slowly rollout these changes back to the main branch. Minimal re-review should be necessary

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request introduces a custom retry predicate, _rst_stream_aware_predicate, for ReadRows operations in both the asynchronous and synchronous Bigtable clients. This predicate treats specific InternalServerError messages (such as "rst_stream") as ServiceUnavailable errors to allow them to be retried. The review feedback points out a potential AttributeError in the predicate's implementation if e.message is None, and suggests adding a type check to ensure e.message is a string before calling .lower().

@daniel-sanche
daniel-sanche force-pushed the shim/10-read-rows-rst-stream branch from dd45c75 to 6348bb9 Compare September 2, 2026 18:42
@daniel-sanche
daniel-sanche force-pushed the shim/10-read-rows-rst-stream branch from 6348bb9 to bdd2d76 Compare September 2, 2026 19:22
@daniel-sanche
daniel-sanche marked this pull request as ready for review September 2, 2026 19:28
@daniel-sanche
daniel-sanche requested a review from a team as a code owner September 2, 2026 19:28
@daniel-sanche
daniel-sanche force-pushed the shim/10-read-rows-rst-stream branch from c66eaf1 to 560d5b8 Compare September 2, 2026 19:58
@daniel-sanche
daniel-sanche force-pushed the shim/10-read-rows-rst-stream branch from 560d5b8 to 2e76f2d Compare September 2, 2026 21:58
# special case: treat InternalServerError with rst_stream error message as ServiceUnavailable
def rst_check(e):
return (
core_exceptions.ServiceUnavailable in exception_types

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.

is this right? why would it be both ServiceUnavailable and InternalServerError?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not as familiar with the details of his exception, but the logic seems right to me:

  • The comment says: # special case: treat InternalServerError with rst_stream error message as ServiceUnavailable. So the goal is essentially to transform one type to another
  • The first line checks if the predicate is configured to retry ServiceUnavailable exceptions
  • The second line checks if the incoming error is an InternalServerError
  • The other lines are checking of the message matches the special-case string, to determine whether to transform it

@daniel-sanche
daniel-sanche force-pushed the shim/10-read-rows-rst-stream branch from 2e76f2d to 63d087e Compare September 3, 2026 22:40
@daniel-sanche
daniel-sanche force-pushed the shim/10-read-rows-rst-stream branch from 63d087e to 5b27fa2 Compare September 4, 2026 18:56
gkevinzheng and others added 3 commits September 4, 2026 13:49
According to go/rst_stream, `INTERNAL` errors with error messages
related to an `rst_stream` error should be interpreted as `UNAVAILABLE`
errors instead of internal errors. This PR creates a custom retry
predicate to allow retrying of `INTERNAL` errors with rst_stream
specific error messages if the `ServiceUnavailable` exception is allowed
to be retried.

---------

Co-authored-by: Daniel Sanche <sanche@google.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@daniel-sanche
daniel-sanche force-pushed the shim/10-read-rows-rst-stream branch from 5b27fa2 to f34bacd Compare September 4, 2026 20:49
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.

3 participants