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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: pass timeout to 'PartialRowsData.response_iterator' #16
Merged
tseaver
merged 8 commits into
googleapis:master
from
MaxxleLLC:#6---Bigtable-read_rows-no-deadline
Sep 2, 2020
Merged
fix: pass timeout to 'PartialRowsData.response_iterator' #16
tseaver
merged 8 commits into
googleapis:master
from
MaxxleLLC:#6---Bigtable-read_rows-no-deadline
Sep 2, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
googlebot
added
the
cla: yes
This human has signed the Contributor License Agreement.
label
Mar 31, 2020
mf2199
added
the
do not merge
Indicates a pull request not ready for merge, due to either quality or timing.
label
Mar 31, 2020
mf2199
changed the title
fix: cbt-6 [added timeout value to PartialRowsData.response_iterator]
fix: [cbt-6] Added timeout value to PartialRowsData.response_iterator.
Apr 1, 2020
@kolea2 Friendly ping. |
kolea2
reviewed
May 28, 2020
mf2199
changed the title
fix: [cbt-6] Added timeout value to PartialRowsData.response_iterator.
fix: [cbt-6] Added timeout value to PartialRowsData.response_iterator
May 28, 2020
mf2199
added
the
kokoro:force-run
Add this label to force Kokoro to re-run the tests.
label
May 28, 2020
yoshi-kokoro
removed
the
kokoro:force-run
Add this label to force Kokoro to re-run the tests.
label
May 28, 2020
mf2199
removed
do not merge
Indicates a pull request not ready for merge, due to either quality or timing.
status: blocked
Resolving the issue is dependent on other work.
labels
Jul 23, 2020
tseaver
reviewed
Aug 6, 2020
tseaver
approved these changes
Aug 18, 2020
kolea2
reviewed
Aug 19, 2020
@@ -400,7 +400,7 @@ def __init__(self, read_method, request, retry=DEFAULT_RETRY_READ_ROWS): | |||
self.read_method = read_method | |||
self.request = request | |||
self.retry = retry | |||
self.response_iterator = read_method(request) | |||
self.response_iterator = read_method(request, timeout=self.retry._deadline + 1) |
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.
why is this + 1? Can you add a comment explaining?
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.
@kolea2 Sure, copied from the PR description.
tseaver
changed the title
fix: [cbt-6] Added timeout value to PartialRowsData.response_iterator
fix: pass timeout to 'PartialRowsData.response_iterator'
Sep 2, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This offers a minimally invasive solution to the client hanging issue. As reported by the author and reproduced using the emulator, the client hangs when there is no response from the CBT server. One of the causes is the specified
deadline
not propagating to the corresponding gRPC calls. The proposed change links this input with the_grpc._UnaryStreamMultiCallable.__call__.timeout
parameter by adding it as a keyword argument to thePartialRowsData
constructor.An alternative way would invoke gapic
wrap_method
to wrap thebigtable_data_client.transport.read_rows
, along with the user-suppliedtimeout
value. But that would bindTable.read_rows
to gapic retry engine instead of the 'smart' retries offered by 'raw' gRPC. The latter supposedly avoids repeating the whole read sequence in a case of a transient failure, the lack of which may become an issue with large reads, when chances of error become significant while the time needed to complete the sequence gets increasingly large. Another possible approach is to call gapic'sbigtable_data_client.read_rows
instead ofbigtable_data_client.transport.read_rows
. But that would also invoke gapic retries and may cause the same problem as described above.The
timeout
parameter must be somewhat greater than the value contained inself.retry
, in order to avoid race-like condition and allow registering the first deadline error before invoking the retry. Otherwise there is a risk of getting stuck in an infinite loop that resets the timeout counter just before it being triggered. The increment by 1 second here is customary but should not be much less than that.*** NOTE: The kokoro tests are bound to fail as the
deadline
property of theRetry
class has not been exposed yet. This is being addressed in a separate PR. ***The coverage test does not register these changes, hence adding a unit test for now has been left as an option.
Fixes #6 馃