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

config: add pd client option to enable request redirection #23025

Merged
merged 10 commits into from
Mar 16, 2021

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented Mar 1, 2021

What problem does this PR solve?

Problem Summary:

When there is a network partition problem happens between TiDB and PD or allocator leader, it can not serve anymore at the moment.

What is changed and how it works?

What's Changed:

How it Works: This PR is going to add an option to make PD client can redirect the requests to PD or allocator leader if there is a network partition problem.

This PR should be merged after tikv/pd#3431 is merged.

Tests

  • Manual test

Release note

  • Add PD client option to enable request redirection

@ti-chi-bot ti-chi-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 1, 2021
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 2, 2021
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 10, 2021
@ti-chi-bot ti-chi-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 13, 2021
@rleungx
Copy link
Member Author

rleungx commented Mar 13, 2021

/run-all-tests

@rleungx
Copy link
Member Author

rleungx commented Mar 13, 2021

/run-all-tests

@rleungx
Copy link
Member Author

rleungx commented Mar 13, 2021

/cc @nolouch @MyonKeminta @BusyJay

Copy link
Contributor

@BusyJay BusyJay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM

config/config.go Outdated
@@ -176,6 +176,9 @@ type Config struct {
// EnableTCP4Only enables net.Listen("tcp4",...)
// Note that: it can make lvs with toa work and thus tidb can get real client ip.
EnableTCP4Only bool `toml:"enable-tcp4-only" json:"enable-tcp4-only"`
// The client will forward the requests to the PD or allocator leader through the follower
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment should be updated to be more generic as it doesn't just control the behavior of PD client.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I forgot about it.

@rleungx
Copy link
Member Author

rleungx commented Mar 15, 2021

/run-all-tests

@rleungx
Copy link
Member Author

rleungx commented Mar 15, 2021

/run-all-tests

@rleungx rleungx requested a review from BusyJay March 15, 2021 09:07
Copy link
Member

@nolouch nolouch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ti-chi-bot
Copy link
Member

@nolouch: Please use /LGTM instead of LGTM when you want to approve the pull request by comment.
If you use the GitHub review feature, please approve the PR directly, the comment will not take effect in the GitHub review feature.
If you have any qustions please refer to lgtm command help or lgtm plugin design.

If you have approved this PR, please ignore this reply. This reply is being used as a temporary reply during the migration of the new bot and will be removed on April 1.

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.

@ti-chi-bot
Copy link
Member

@nolouch: /lgtm is only allowed for the reviewers in list.

In response to this:

lgtm

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.

@nolouch nolouch removed the sig/sql-infra SIG: SQL Infra label Mar 15, 2021
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 15, 2021
Copy link
Contributor

@MyonKeminta MyonKeminta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM

@@ -278,6 +278,7 @@ spilled-file-encryption-method = "plaintext"
c.Assert(conf.Security.SpilledFileEncryptionMethod, Equals, SpilledFileEncryptionMethodPlaintext)
c.Assert(conf.DeprecateIntegerDisplayWidth, Equals, true)
c.Assert(conf.EnableEnumLengthLimit, Equals, false)
c.Assert(conf.EnableForwarding, Equals, false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this test, you should try to set the value to a non-default value in the config text above, and assert it's actually set to a non-default value. So you should add enable-forwarding=true at about L200 and assert it's true here.

@@ -24,6 +24,7 @@ import (
"time"

"github.com/pingcap/errors"
tidbconfig "github.com/pingcap/tidb/config"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid that you may need to check if it breaks the work about extracting the tikvclient out from tidb repo.
cc @disksing

rleungx added 7 commits March 16, 2021 16:36
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
Signed-off-by: Ryan Leung <rleungx@gmail.com>
@rleungx
Copy link
Member Author

rleungx commented Mar 16, 2021

/label needs-cherry-pick-5.0

Copy link
Contributor

@MyonKeminta MyonKeminta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-chi-bot
Copy link
Member

@MyonKeminta: Please use /LGTM instead of LGTM when you want to approve the pull request by comment.
If you use the GitHub review feature, please approve the PR directly, the comment will not take effect in the GitHub review feature.
If you have any qustions please refer to lgtm command help or lgtm plugin design.

If you have approved this PR, please ignore this reply. This reply is being used as a temporary reply during the migration of the new bot and will be removed on April 1.

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.

@ti-chi-bot
Copy link
Member

@MyonKeminta: /lgtm is only allowed for the reviewers in list.

In response to this:

LGTM

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.

Copy link
Contributor

@AndreMouche AndreMouche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-chi-bot
Copy link
Member

@AndreMouche: Please use /LGTM instead of LGTM when you want to approve the pull request by comment.
If you use the GitHub review feature, please approve the PR directly, the comment will not take effect in the GitHub review feature.
If you have any qustions please refer to lgtm command help or lgtm plugin design.

If you have approved this PR, please ignore this reply. This reply is being used as a temporary reply during the migration of the new bot and will be removed on April 1.

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.

@AndreMouche
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 641755d

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 16, 2021
@ti-chi-bot ti-chi-bot merged commit 0bfef64 into pingcap:master Mar 16, 2021
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Mar 16, 2021
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-5.0 in PR #23358

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/config needs-cherry-pick-release-5.0 sig/sql-infra SIG: SQL Infra 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.

7 participants