-
Notifications
You must be signed in to change notification settings - Fork 721
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
pkg: support service discovery #5911
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. |
Skipping CI for Draft Pull Request. |
Codecov ReportBase: 75.38% // Head: 75.23% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #5911 +/- ##
==========================================
- Coverage 75.38% 75.23% -0.15%
==========================================
Files 359 362 +3
Lines 36167 36221 +54
==========================================
- Hits 27265 27252 -13
- Misses 6547 6600 +53
- Partials 2355 2369 +14
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@binshi-bing PTAL |
server/schedule/operator/builder.go
Outdated
@@ -524,7 +524,7 @@ func (b *Builder) prepareBuild() (string, error) { | |||
} | |||
|
|||
// Although switch witness may have nothing to do with conf change (except switch witness voter to non-witness voter: |
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.
switching
pkg/mcs/discovery/register.go
Outdated
cancel: cancel, | ||
cli: cli, | ||
key: serviceKey, | ||
value: serviceAddr, |
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.
Since we use range scan to discover, can we use "/pd/microserivce/{service name}/registry/{ip:port}" as the key, weight or a json, which contains host properties and starts with weight, as the value?
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.
For more details of my comment, please see my comments in the design doc.
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.
I'm going to change the value to a string, which can be serialized by different services themselves.
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.
sounds good
) | ||
|
||
// Discover is used to get all the service instances of the specified service name. | ||
func Discover(cli *clientv3.Client, serviceName string) ([]string, 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.
The design doc contains server register, service instance discovery and service discovery. This function is the second one. For tenant tso, in the third part "service discover", we need to get the server endpoint for a given key space group. Could you list which functionalities are provided by this PR? And we can implement the remaining functionalities in the next PRs.
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
8c3baca
to
1067533
Compare
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, though it isn't counted
@binshi-bing: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments. In response to this:
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. |
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.
the rest LGTM
registryKey = "registry" | ||
) | ||
|
||
func registryPath(serviceName, serviceAddr string) string { |
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.
do we need tenant now?
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.
service instance (node) registry path doesn't contain tenant/keyspace. The tenant/keyspace group primary discovery path does.
/merge |
@rleungx: 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. |
@rleungx: In response to this:
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. |
/merge |
@rleungx: 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: 1067533
|
@rleungx: Your PR was out of date, I have automatically updated it for you. If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. 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. |
Signed-off-by: Ryan Leung rleungx@gmail.com
What problem does this PR solve?
This PR supports service discovery for microservice architecture. The detailed usage can be found in the unit tests.
Issue Number: Ref #5895.
What is changed and how does it work?
Check List
Tests
Release note