Skip to content
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

[close #635] constraint the getMember timeout by inject a backoffer #636

Merged

Conversation

iosmanthus
Copy link
Member

@iosmanthus iosmanthus commented Jul 27, 2022

Signed-off-by: iosmanthus [email protected]

What problem does this PR solve?

Issue Number: close #635

Problem Description:

The getMembers is not limited by a backoffer, which might cause the exception will not throw in time. For example, a user might set the timeout of a request to 400ms, but if the PD is disconnected, the getMembers might sleep more than 400ms since the backoffer it used is not passed from the upper code.

What is changed and how does it work?

Inject a backoffer for getMembers and check timeout before acquiring a channel from the pool.

Check List for Tests

This PR has been tested by at least one of the following methods:

  • Unit test

Related changes

  • Need to cherry-pick the release branch

@codecov
Copy link

codecov bot commented Jul 27, 2022

Codecov Report

Merging #636 (95f9b92) into master (2ae746d) will increase coverage by 0.28%.
The diff coverage is 57.14%.

@@             Coverage Diff              @@
##             master     #636      +/-   ##
============================================
+ Coverage     34.68%   34.96%   +0.28%     
- Complexity     1420     1435      +15     
============================================
  Files           278      278              
  Lines         17358    17361       +3     
  Branches       1972     1974       +2     
============================================
+ Hits           6020     6071      +51     
+ Misses        10726    10675      -51     
- Partials        612      615       +3     
Impacted Files Coverage Δ
.../main/java/org/tikv/common/AbstractGRPCClient.java 49.35% <ø> (+7.04%) ⬆️
...java/org/tikv/common/operation/PDErrorHandler.java 38.70% <50.00%> (ø)
src/main/java/org/tikv/common/PDClient.java 64.75% <58.33%> (+7.93%) ⬆️
...g/tikv/common/operation/iterator/ScanIterator.java 76.31% <0.00%> (-2.64%) ⬇️
...ty/handler/codec/http2/Http2ConnectionHandler.java 48.65% <0.00%> (-2.45%) ⬇️
src/main/java/io/grpc/internal/ClientCallImpl.java 57.07% <0.00%> (+0.24%) ⬆️
...rc/main/java/io/grpc/netty/NettyClientHandler.java 56.89% <0.00%> (+0.64%) ⬆️
...n/java/org/tikv/common/util/ConcreteBackOffer.java 84.68% <0.00%> (+0.90%) ⬆️
src/main/java/org/tikv/common/TiConfiguration.java 70.82% <0.00%> (+3.45%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2ae746d...95f9b92. Read the comment docs.

@ti-srebot
Copy link
Collaborator

@zhangyangyu, Thanks for your review. The bot only counts LGTMs from Reviewers and higher roles, but you're still welcome to leave your comments. You are not a reviewer or committer or co-leader or leader.

Copy link
Member

@sunxiaoguang sunxiaoguang left a comment

Choose a reason for hiding this comment

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

LGTM

@iosmanthus iosmanthus merged commit 3128161 into tikv:master Jul 27, 2022
ti-srebot pushed a commit to ti-srebot/client-java that referenced this pull request Jul 27, 2022
@ti-srebot
Copy link
Collaborator

cherry pick to release-3.3 in PR #637

iosmanthus added a commit that referenced this pull request Jul 29, 2022
Signed-off-by: ti-srebot <[email protected]>

Co-authored-by: iosmanthus <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PD getMembers's timeout duration is not limited by the config.
4 participants