-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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: handle the error of "mismatch cluster id" #7053
Conversation
store/tikv/backoff.go
Outdated
@@ -233,6 +234,9 @@ func (b *Backoffer) Backoff(typ backoffType, err error) error { | |||
} | |||
} | |||
log.Warn(errMsg) | |||
if strings.Contains(errMsg, ErrMismatchClusterID.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.
Can we define a string constant for "mismatch cluster id"?
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.
Is it better to check and handle this in the pd-client? @disksing What do you think about it?
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 think we can check it at the beginning of this function.
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.
Good idea.
store/tikv/error.go
Outdated
@@ -22,6 +22,8 @@ import ( | |||
var ( | |||
// ErrBodyMissing response body is missing error | |||
ErrBodyMissing = errors.New("response body is missing") | |||
// ErrMismatchClusterID returns the error that the cluster ID of the PD client does not match the PD. | |||
ErrMismatchClusterID = errors.New("mismatch cluster id") |
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.
We don't need to define an error if we never throw it.
I think just make the string constant and check the string will do.
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.
Agree
LGTM |
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
/run-all-tests |
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
What have you changed? (mandatory)
We will exit the current TiDB when we encounter the error of "mismatch cluster id, need 6577643568868929567 but got 6577623361857143480".
The TiDB will meet the error of “mismatch cluster id” when the cluster ID of the TiDB‘s PD client does not match the PD.
What is the type of the changes? (mandatory)
How has this PR been tested? (mandatory)
In local
Does this PR affect documentation (docs/docs-cn) update? (mandatory)
No
Does this PR affect tidb-ansible update? (mandatory)
No
Does this PR need to be added to the release notes? (mandatory)