-
Notifications
You must be signed in to change notification settings - Fork 759
client: resource manager service discovery #9785
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
Merged
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
eadad73
client: resource manager service discovery (#391)
disksing 52f62c0
Merge branch 'master' of https://github.com/tikv/pd into rm-client-di…
okJiang 543be8d
Merge branch 'master' of github.com:tikv/pd into rm-client-discovery
okJiang d3c9b27
support TestServerPrimaryChange
okJiang 012ffc9
enable register and member test
okJiang 584a0d4
fallback to call pd server if can't find resource manager
okJiang 914d163
save
okJiang e0336c4
revert some test
okJiang adbac15
Merge branch 'master' of github.com:tikv/pd into rm-client-discovery
okJiang d9ebeea
add test and remove option
okJiang 9411339
client: update resource manager serivce url after error (#436)
disksing 5d2fde2
add comment
okJiang 480a01d
update log level
okJiang 17f134e
fix lint
okJiang 52ef981
deploy tso server
okJiang 0806426
introduce provider
okJiang d01cc9c
fix lint
okJiang 3842062
fix data race
okJiang 3e2a379
add wait group to ResourceGroupsController for graceful shutdown
okJiang 5ed0fba
revert kvproto
okJiang 4f503dc
remove provider
okJiang fbd583b
fix lint
okJiang 73280e0
fix ut
okJiang 16e6e2b
fix ut
okJiang 7d73688
fix comment
okJiang 2476a1f
introduce retry pkg
okJiang 036da6c
fix lint
okJiang c7d8747
fix comment: rename
okJiang faa6908
fix lint
okJiang 5e3cdf1
add switch test
okJiang 933dc3f
Merge branch 'rm-client-discovery' of github.com:okJiang/pd into rm-c…
okJiang ccf8aca
fix lint
okJiang 94fa471
fix lint
okJiang 1cea5b6
fix comment and enhance unit test
okJiang 9687b2b
add more check
okJiang 6b931f4
fix comment
okJiang 7a05484
fix typo
okJiang f2c0e74
add error handling for resource manager service URL updates
okJiang d32d809
fix comment: rename
okJiang 1ed5031
fix typo
okJiang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| // Copyright 2025 TiKV Project Authors. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package retry | ||
|
|
||
| import ( | ||
| "context" | ||
| "time" | ||
|
|
||
| "github.com/pingcap/errors" | ||
| ) | ||
|
|
||
| var ( | ||
| // QueryRetryMaxTimes is the max retry times for querying microservice. | ||
| queryRetryMaxTimes = 10 | ||
| // queryRetryInterval is the retry interval for querying microservice. | ||
| queryRetryInterval = 500 * time.Millisecond | ||
| ) | ||
|
|
||
| // WithConfig retries the given function with a fixed interval. | ||
| func WithConfig( | ||
| ctx context.Context, f func() error, | ||
| ) error { | ||
| return Retry(ctx, queryRetryMaxTimes, queryRetryInterval, f) | ||
| } | ||
|
|
||
| // Retry retries the given function with a fixed interval. | ||
| func Retry( | ||
| ctx context.Context, maxTimes int, interval time.Duration, f func() error, | ||
| ) error { | ||
| var err error | ||
| ticker := time.NewTicker(interval) | ||
| defer ticker.Stop() | ||
| for range maxTimes { | ||
| if err = f(); err == nil { | ||
| return nil | ||
| } | ||
| select { | ||
| case <-ctx.Done(): | ||
| return err | ||
| case <-ticker.C: | ||
| } | ||
| } | ||
| return errors.WithStack(err) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
How to handle
ServiceMode_UNKNOWN_SVC_MODE?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 error like before. I reverted this line 7d73688