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

gomod: update pdclient to support backoff mechanism for memberLoop #46769

Merged
merged 3 commits into from
Sep 13, 2023

Conversation

HuSharp
Copy link
Contributor

@HuSharp HuSharp commented Sep 8, 2023

Signed-off-by: husharp [email protected]<!--

Thank you for contributing to TiDB!

PR Title Format:

  1. pkg [, pkg2, pkg3]: what's changed
  2. *: what's changed

-->

What problem does this PR solve?

Issue Number: close #46770, ref tikv/pd#6556

Problem Summary:

  • 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.

PR Summary

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 3.2k to 170, which is relative to the TiDB numbers and client requests for triaging checkLeader.

For 20 * tidb 3 * PD 50 * TiKV
170 = (50 * 3 / 3 / 3[TiKV side] + 20 * 2 [TiDB side]) * 3[PD Num]

And more tests are necessary to ensure that no further issues arise.

image

What is changed and how it works?

Check List

test by pd
Tests

  • Unit test
  • Integration test

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

update pdclient to support backoff mechanism for memberLoop

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked release-note Denotes a PR that will be considered when it comes time to generate release notes. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 8, 2023
@HuSharp HuSharp closed this Sep 8, 2023
@HuSharp HuSharp force-pushed the update_client_backoff branch from 9681e53 to fadfb63 Compare September 8, 2023 03:37
Signed-off-by: husharp <[email protected]>
@codecov
Copy link

codecov bot commented Sep 8, 2023

Codecov Report

Merging #46769 (d6e8d0e) into master (a8bd506) will decrease coverage by 0.4456%.
Report is 12 commits behind head on master.
The diff coverage is n/a.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #46769        +/-   ##
================================================
- Coverage   73.2795%   72.8340%   -0.4456%     
================================================
  Files          1330       1352        +22     
  Lines        397448     405934      +8486     
================================================
+ Hits         291248     295658      +4410     
- Misses        87588      91656      +4068     
- Partials      18612      18620         +8     
Flag Coverage Δ
integration 28.3436% <ø> (?)
unit 73.4885% <ø> (+0.2090%) ⬆️

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

Components Coverage Δ
dumpling 54.0444% <ø> (ø)
parser 84.9922% <ø> (+0.0010%) ⬆️
br 48.6177% <ø> (-4.2738%) ⬇️

@HuSharp
Copy link
Contributor Author

HuSharp commented Sep 8, 2023

/test check-dev

@HuSharp
Copy link
Contributor Author

HuSharp commented Sep 8, 2023

/test unit-test

@tiprow
Copy link

tiprow bot commented Sep 8, 2023

@HuSharp: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test check-dev

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tiprow
Copy link

tiprow bot commented Sep 8, 2023

@HuSharp: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test unit-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@HuSharp
Copy link
Contributor Author

HuSharp commented Sep 8, 2023

/check-issue-triage-complete

@HuSharp
Copy link
Contributor Author

HuSharp commented Sep 8, 2023

/retest-required

Signed-off-by: husharp <[email protected]>
@ti-chi-bot ti-chi-bot bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 8, 2023
@HuSharp
Copy link
Contributor Author

HuSharp commented Sep 8, 2023

@JmPotato @nolouch PTAL, thx!

@HuSharp
Copy link
Contributor Author

HuSharp commented Sep 8, 2023

@YuJuncen YuJuncen removed the needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. label Sep 8, 2023
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 11, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 12, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hawkingrei, nolouch

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 12, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 12, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-09-11 03:32:33.809934191 +0000 UTC m=+240135.734490586: ☑️ agreed by hawkingrei.
  • 2023-09-12 08:41:29.091708942 +0000 UTC m=+345071.016265441: ☑️ agreed by nolouch.

Signed-off-by: husharp <[email protected]>
@ti-chi-bot ti-chi-bot bot added the needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. label Sep 13, 2023
@HuSharp
Copy link
Contributor Author

HuSharp commented Sep 13, 2023

/test build

@tiprow
Copy link

tiprow bot commented Sep 13, 2023

@HuSharp: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test build

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@HuSharp
Copy link
Contributor Author

HuSharp commented Sep 13, 2023

/retest-required

@HuSharp
Copy link
Contributor Author

HuSharp commented Sep 13, 2023

/test unit-test

@tiprow
Copy link

tiprow bot commented Sep 13, 2023

@HuSharp: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test unit-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@hawkingrei
Copy link
Member

/retest

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #46954.

@HuSharp HuSharp deleted the update_client_backoff branch September 13, 2023 12:26
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Sep 13, 2023
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #46955.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Too many MemberList request after PD lost leader for a while
5 participants