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

client: support add ready for resp and add backoff mechanism #6974

Closed
wants to merge 4 commits into from

Conversation

HuSharp
Copy link
Member

@HuSharp HuSharp commented Aug 22, 2023

What problem does this PR solve?

Issue Number: ref #6556

What is changed and how does it work?

PR Summary

  1. Add ready for resp
  • Have goroutine reconnectMemberLoop call updateMember periodically. When calling ScheduleCheckMemberChanged channel, we need to wait for the goroutine to update members until ready or timeout.
  1. Add backoff mechanism
  • When waiting for the goroutine to update, the expo function can be used to backoff to sleep when an error is encountered.

Reproduce Step

  1. enable fail point, like gRPC is throttling, cannot read from etcd.
    curl -X PUT -d 'return(10)' http://tc-pd-1.tc-pd-peer.csn-simulator-big-cluster-vd62g.svc:2379/pd/api/v1/fail/github.com/tikv/pd/pkg/etcdutil/SlowEtcdKVGet

  2. simulate pd lost leader
    curl -X PUT -d 'return("2346857576170797299")' http://tc-pd-1.tc-pd-peer.csn-simulator-big-cluster-vd62g.svc:2379/pd/api/v1/fail/github.com/tikv/pd/server/exitCampaignLeader

Reproduce Result

Grpc request GetMember keeps high:
image

TiKV side show

image

PR Effect

The Grpc GetMember call was reduced from 778 to 216, which is relative to the TiDB numbers and client requests for triaging checkLeader.

And more tests are necessary to ensure that no further issues arise.
img_v2_8cd9712b-b946-41cd-9052-1eefe08f3f3g

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

Release note

None.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 22, 2023

[REVIEW NOTIFICATION]

This pull request has not been approved.

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 22, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none labels Aug 22, 2023
@ti-chi-bot ti-chi-bot bot requested review from JmPotato and rleungx August 22, 2023 10:07
@ti-chi-bot ti-chi-bot bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 22, 2023
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 23, 2023
@codecov
Copy link

codecov bot commented Aug 23, 2023

Codecov Report

Merging #6974 (670bc4a) into master (1743552) will decrease coverage by 0.02%.
Report is 1 commits behind head on master.
The diff coverage is 74.34%.

❗ Current head 670bc4a differs from pull request most recent head 1005871. Consider uploading reports for the commit 1005871 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6974      +/-   ##
==========================================
- Coverage   74.25%   74.23%   -0.02%     
==========================================
  Files         433      435       +2     
  Lines       45904    46010     +106     
==========================================
+ Hits        34085    34157      +72     
- Misses       8810     8842      +32     
- Partials     3009     3011       +2     
Flag Coverage Δ
unittests 74.23% <74.34%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Signed-off-by: husharp <jinhao.hu@pingcap.com>
@nolouch nolouch changed the title client: support add ready for resp client: support add ready for resp and add backoff mechanism Aug 23, 2023
Signed-off-by: husharp <jinhao.hu@pingcap.com>
@HuSharp HuSharp marked this pull request as ready for review August 23, 2023 09:29
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 23, 2023
@HuSharp HuSharp requested a review from nolouch August 23, 2023 09:29
@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 24, 2023
Signed-off-by: husharp <jinhao.hu@pingcap.com>
@niubell
Copy link
Contributor

niubell commented Aug 31, 2023

Use a new pr #6978 (release-6.5), #6995 (master) to add backoff mechanism and this pr should be closed

@HuSharp
Copy link
Member Author

HuSharp commented Aug 31, 2023

Use a new pr #6978 (release-6.5), #6995 (master) to add backoff mechanism and this pr should be closed

Closed.

@HuSharp HuSharp closed this Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants