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

store/tikv: forward requests by unary call #23362

Merged
merged 3 commits into from
Mar 17, 2021

Conversation

youjiali1995
Copy link
Contributor

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 gRPC metadata{"tikv-forwarded-host": ForwardedHost} will be attached to the request. TiKV which receives the request will check it and forward the request to the ForwardedHost 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

  • Need to cherry-pick to the release branch

Check List

Tests

Side effects

Release note

  • No release note.

Signed-off-by: youjiali1995 <zlwgx1023@gmail.com>
@ti-chi-bot ti-chi-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 17, 2021
@youjiali1995
Copy link
Contributor Author

/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() {
Copy link
Contributor

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.

Copy link
Contributor Author

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'.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 17, 2021
@tiancaiamao
Copy link
Contributor

/LGTM

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • MyonKeminta
  • tiancaiamao

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 writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 17, 2021
@youjiali1995
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: c7413fc

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 17, 2021
@tiancaiamao
Copy link
Contributor

/merge

@ti-chi-bot ti-chi-bot merged commit 77713d2 into pingcap:master Mar 17, 2021
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Mar 17, 2021
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-5.0 in PR #23377

SabaPing pushed a commit to SabaPing/tidb that referenced this pull request Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/tikv needs-cherry-pick-release-5.0 sig/transaction SIG:Transaction size/L Denotes a PR that changes 100-499 lines, ignoring generated files. 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.

5 participants