fix(bigtable): Added rst_stream exception handling for ReadRows. - #18197
fix(bigtable): Added rst_stream exception handling for ReadRows.#18197daniel-sanche wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
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().
dd45c75 to
6348bb9
Compare
6348bb9 to
bdd2d76
Compare
c66eaf1 to
560d5b8
Compare
560d5b8 to
2e76f2d
Compare
| # special case: treat InternalServerError with rst_stream error message as ServiceUnavailable | ||
| def rst_check(e): | ||
| return ( | ||
| core_exceptions.ServiceUnavailable in exception_types |
There was a problem hiding this comment.
is this right? why would it be both ServiceUnavailable and InternalServerError?
There was a problem hiding this comment.
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
2e76f2d to
63d087e
Compare
63d087e to
5b27fa2
Compare
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>
5b27fa2 to
f34bacd
Compare
Migrating over @gkevinzheng PR from bigtable monorepo googleapis/python-bigtable#1298
Original description:
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