-
Notifications
You must be signed in to change notification settings - Fork 98
chore(x-goog-spanner-request-id): more updates for batch_write + mockserver tests #1375
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
base: main
Are you sure you want to change the base?
chore(x-goog-spanner-request-id): more updates for batch_write + mockserver tests #1375
Conversation
Kindly help me run the bots on this @olavloite @surbhigarg92 @harshachinta @sakthivelmanii |
19e341a
to
2cd1502
Compare
8000c2c
to
64bd582
Compare
64bd582
to
fa77dd1
Compare
Kindly help me re-run those bots @olavloite |
3af40e4
to
4cd0c31
Compare
@olavloite @surbhigarg92 @sakthivelmanii @harshachinta @rahul2393 kindly help me re-run the bots. Thank you. |
4ac9fef
to
422f858
Compare
google/cloud/spanner_v1/pool.py
Outdated
allowed_exceptions={ | ||
InternalServerError: _check_rst_stream_error, | ||
ServiceUnavailable: _check_unavailable, | ||
}, |
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.
We should not add new retry logic here (and in general also not elsewhere). The general rules for retries are:
- For unary RPCs: We rely on Gax handling all retries. This means that any RPC that has been configured as retryable at that level are automatically retried by Gax. We don't need to do anything in the handwritten client library. Currently, the retry configuration specifies that
UNAVAILABLE
andRESOUCE_EXHAUSTED
are retryable error codes. But the client does not need to know, as this is handled by Gax. - For streaming RPCs: The have disabled retries by Gax by not adding any retryable error codes to the configuration. Retries of streaming RPCs therefore need to be handled manually in the handwritten client. Streaming RPCs should be retried in case of an UNAVAILABLE error, OR if it is one of the specific INTERNAL errors. (Note however that it is fair to consider the current retry implementation as complete, even if for example specific INTERNAL errors are currently not retried. Adding support for request-id is not about fixing potentially missing retry logic.)
- For transactions, we retry the entire transaction if the transaction is aborted by Spanner. This type of retry is 'irrelevant' for the request-id. With 'irrelevant' I mean that these retries do not need any special handling, and should not lead to the attempt number being increased.
|
||
def test_unary_retryable_error(self): | ||
add_select1_result() | ||
add_error(SpannerServicer.BatchCreateSessions.__name__, unavailable_status()) |
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.
I changed the error code here from INTERNAL
to UNAVAILABLE
, because:
INTERNAL
was not retried before for unary RPCs, and this change should not add retries for that. The specificINTERNAL
errors that are retried are only relevant for streaming RPCs.- This PR seems to try to add additional retry handling for
UNAVAILABLE
errors. That handling is however never used, because the RPC itself is already retried by Gax, and this happens at a lower level. This again causes this test to seem to work, however the attempt number is not being increased during these retries. Because this test initially usedINTERNAL
to test, the additional retry handler was being invoked, and that did increase the attempt number.
…server tests This change plumbs in some x-goog-spanner-request-id updates for batch_write and some tests too. Updates googleapis#1261
nox -s blacken to format
c62dab6
to
092efe5
Compare
3da8c25
to
67d0131
Compare
@olavloite I've added a TODO so that we can firstly merge the code in and then can fully focus on figuring out request-id with unary retries. Kindly please take a look at the existing code |
This change plumbs in some x-goog-spanner-request-id updates for batch_write and some tests too.
Updates #1261