-
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
Add a test which provokes abort-during-read during 'run_in_transaction'. #3663
Conversation
|
@dhermes, @bjwatson, @lukesneeringer OK, I have the test passing, but to do so I have to straddle the fact that the GAPIC / gRPC bits sometimes raise a Specifics:
My hack to get the read-abort bit passing: @@ -312,7 +334,12 @@ def _delay_until_retry(exc, deadline):
:type deadline: float
:param deadline: maximum timestamp to continue retrying the transaction.
"""
- if exc_to_code(exc.cause) != StatusCode.ABORTED:
+ if isinstance(exc, GrpcRendezvous):
+ cause = exc
+ else:
+ cause = exc.cause
+
+ if exc_to_code(cause) != StatusCode.ABORTED:
raise
now = time.time()
@@ -320,7 +347,7 @@ def _delay_until_retry(exc, deadline):
if now >= deadline:
raise
- delay = _get_retry_delay(exc)
+ delay = _get_retry_delay(cause)
if delay is not None:
if now + delay > deadline:
@@ -330,7 +357,7 @@ def _delay_until_retry(exc, deadline):
# pylint: enable=misplaced-bare-raise
-def _get_retry_delay(exc):
+def _get_retry_delay(cause):
"""Helper for :func:`_delay_until_retry`.
:type exc: :class:`google.gax.errors.GaxError`
@@ -339,7 +366,7 @@ def _get_retry_delay(exc):
:rtype: float
:returns: seconds to wait before retrying the transaction.
"""
- metadata = dict(exc.cause.trailing_metadata())
+ metadata = dict(cause.trailing_metadata())
retry_info_pb = metadata.get('google.rpc.retryinfo-bin')
if retry_info_pb is not None:
retry_info = RetryInfo() |
Turns out my issue is the same as #3562. |
ca441f7
to
f916edc
Compare
The test failure is for coverage of branches added in the to-be-backed-out commit (f916edc). |
@tseaver I removed the |
@jonparrott Note that for the @bjwatson Am I still supposed to be catching |
@tseaver yes, in this case catch GaxError and grpc.Call. |
@jonparrott Why are we not fixing the streaming iterator stuff to return only one kind of error? |
@tseaver we are, but it's O(weeks) away, and changing this PR to catch |
@jonparrott Note that one cannot catch Given that the change is intended to be temporary, I will merge with a |
f916edc
to
cf48b5e
Compare
Uses #3615 as a base. ca441f7 is the only change from that PR.