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

*: use another etcd client for election #6409

Merged
merged 2 commits into from
May 12, 2023

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented May 5, 2023

What problem does this PR solve?

Issue Number: Ref #6403.

What is changed and how does it work?

This PR tries to use another etcd client for the election to prevent the throttling of one connection.

Check List

Tests

  • Manual test (TODO)

Release note

None.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented May 5, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • binshi-bing
  • lhy1024

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 ti-chi-bot bot added the release-note-none Denotes a PR that doesn't merit a release note. label May 5, 2023
@ti-chi-bot ti-chi-bot bot requested review from disksing and lhy1024 May 5, 2023 06:49
@codecov
Copy link

codecov bot commented May 5, 2023

Codecov Report

Patch coverage: 50.00% and project coverage change: +0.03 🎉

Comparison is base (1f4599f) 75.03% compared to head (40976cb) 75.07%.

❗ Current head 40976cb differs from pull request most recent head 343bda6. Consider uploading reports for the commit 343bda6 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6409      +/-   ##
==========================================
+ Coverage   75.03%   75.07%   +0.03%     
==========================================
  Files         409      408       -1     
  Lines       41532    41113     -419     
==========================================
- Hits        31165    30867     -298     
+ Misses       7659     7560      -99     
+ Partials     2708     2686      -22     
Flag Coverage Δ
unittests 75.07% <50.00%> (+0.03%) ⬆️

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

Impacted Files Coverage Δ
pkg/utils/etcdutil/etcdutil.go 81.57% <40.00%> (+1.78%) ⬆️
server/server.go 74.60% <42.85%> (-0.43%) ⬇️
pkg/mcs/resource_manager/server/server.go 52.99% <100.00%> (ø)
pkg/mcs/tso/server/server.go 49.16% <100.00%> (-4.29%) ⬇️

... and 61 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

// CreateClients creates etcd v3 client and http client.
func CreateClients(tlsConfig *tls.Config, acUrls url.URL) (*clientv3.Client, *http.Client, error) {
func CreateClients(tlsConfig *tls.Config, acUrls url.URL) (*clientv3.Client, *clientv3.Client, *http.Client, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

return two etcdClient? maybe we can directly create electionClient with another function?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1. The change in pr isn't clean

Copy link
Contributor

Choose a reason for hiding this comment

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

Just call "electionClient, err := createEtcdClient(tlsConfig, acUrls)" to create a dedicate election etcd client is clearer.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmmm... I'm trying to avoid duplicated config initialization.

Copy link
Contributor

Choose a reason for hiding this comment

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

just to add a createEtcdClient in server.go?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1, we can create two clients in startClient not here.

@rleungx rleungx requested review from nolouch and removed request for disksing May 6, 2023 02:34
server/server.go Outdated
return nil
}

func startClient(cfg *config.Config) (*clientv3.Client, *http.Client, error) {
func startClient(cfg *config.Config) (*clientv3.Client, *clientv3.Client, *http.Client, error) {
Copy link
Contributor

@bufferflies bufferflies May 8, 2023

Choose a reason for hiding this comment

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

why not use array? Maybe putting them into on struct is better?

// CreateClients creates etcd v3 client and http client.
func CreateClients(tlsConfig *tls.Config, acUrls url.URL) (*clientv3.Client, *http.Client, error) {
func CreateClients(tlsConfig *tls.Config, acUrls url.URL) (*clientv3.Client, *clientv3.Client, *http.Client, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

+1. The change in pr isn't clean

// CreateClients creates etcd v3 client and http client.
func CreateClients(tlsConfig *tls.Config, acUrls url.URL) (*clientv3.Client, *http.Client, error) {
func CreateClients(tlsConfig *tls.Config, acUrls url.URL) (*clientv3.Client, *clientv3.Client, *http.Client, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just call "electionClient, err := createEtcdClient(tlsConfig, acUrls)" to create a dedicate election etcd client is clearer.

@ti-chi-bot ti-chi-bot bot added status/LGT1 Indicates that a PR has LGTM 1. 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. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed do-not-merge/needs-triage-completed labels May 8, 2023
@ti-chi-bot ti-chi-bot bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 12, 2023
Signed-off-by: Ryan Leung <rleungx@gmail.com>
@ti-chi-bot ti-chi-bot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 12, 2023
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Copy link
Contributor

@nolouch nolouch left a comment

Choose a reason for hiding this comment

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

lgtm

@nolouch
Copy link
Contributor

nolouch commented May 12, 2023

/merge

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented May 12, 2023

@nolouch: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

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 ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented May 12, 2023

This pull request has been accepted and is ready to merge.

Commit hash: 343bda6

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label May 12, 2023
@ti-chi-bot ti-chi-bot bot merged commit d2e73d1 into tikv:master May 12, 2023
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request May 12, 2023
ref tikv#6403

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request May 12, 2023
ref tikv#6403

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot bot added a commit that referenced this pull request May 15, 2023
ref #6403, ref #6409

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Signed-off-by: Ryan Leung <rleungx@gmail.com>

Co-authored-by: Ryan Leung <rleungx@gmail.com>
Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
@rleungx rleungx deleted the election-client branch May 17, 2023 07:31
ti-chi-bot bot added a commit that referenced this pull request May 24, 2023
ref #6403, ref #6409

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Signed-off-by: Ryan Leung <rleungx@gmail.com>

Co-authored-by: Ryan Leung <rleungx@gmail.com>
Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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-none Denotes a PR that doesn't merit a release note. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants