-
Notifications
You must be signed in to change notification settings - Fork 728
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
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Codecov ReportPatch coverage:
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
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
pkg/utils/etcdutil/etcdutil.go
Outdated
// 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) { |
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.
return two etcdClient? maybe we can directly create electionClient with another function?
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.
+1. The change in pr isn't clean
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.
Just call "electionClient, err := createEtcdClient(tlsConfig, acUrls)" to create a dedicate election etcd client is clearer.
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.
Hmmm... I'm trying to avoid duplicated config initialization.
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.
just to add a createEtcdClient
in server.go?
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.
+1, we can create two clients in startClient
not here.
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) { |
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 not use array? Maybe putting them into on struct is better?
pkg/utils/etcdutil/etcdutil.go
Outdated
// 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) { |
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.
+1. The change in pr isn't clean
pkg/utils/etcdutil/etcdutil.go
Outdated
// 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) { |
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.
Just call "electionClient, err := createEtcdClient(tlsConfig, acUrls)" to create a dedicate election etcd client is clearer.
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
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.
lgtm
/merge |
@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. |
This pull request has been accepted and is ready to merge. Commit hash: 343bda6
|
In response to a cherrypick label: new pull request created to branch |
ref tikv#6403 Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created to branch |
ref tikv#6403 Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
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
Release note