-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
store/tikv: forward requests by unary call #23362
store/tikv: forward requests by unary call #23362
Conversation
Signed-off-by: youjiali1995 <zlwgx1023@gmail.com>
/run-all-tests |
@@ -119,6 +119,18 @@ func StoreGlobalConfig(config *Config) { | |||
globalConf.Store(config) | |||
} | |||
|
|||
// UpdateGlobal updates the global config, and provide a restore function that can be used to restore to the original. | |||
func UpdateGlobal(f func(conf *Config)) func() { |
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.
There's a function with the same name in another package and has different usage. I'm kind of afraid it might cause confusion.
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.
It will be extracted to a separated repo and there are many functions like this one in 'store/tikv'.
/LGTM |
[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 writing |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: c7413fc
|
/merge |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.0 in PR #23377 |
Signed-off-by: youjiali1995 zlwgx1023@gmail.com
What problem does this PR solve?
Issue Number: close #xxx
Problem Summary:
Support forwarding requests by unary call.
What is changed and how it works?
What's Changed:
Add a
ForwardedHost
field to Request. When it is set, the gRPCmetadata{"tikv-forwarded-host": ForwardedHost}
will be attached to the request. TiKV which receives the request will check it and forward the request to theForwardedHost
as a proxy. It's useful when network partition occurs.Because gRPC doesn't support setting the metadata for each request in the stream. We don't use BatchCommands for forwarding in this PR.
Related changes
Check List
Tests
Has been tested with store/tikv: Support forwarding via follower when the region's leader is unreachable #23244.
Side effects
Release note