diff --git a/store/tikv/backoff.go b/store/tikv/backoff.go index b9e70af36094e..84a4478fa0837 100644 --- a/store/tikv/backoff.go +++ b/store/tikv/backoff.go @@ -17,6 +17,7 @@ import ( "fmt" "math" "math/rand" + "strings" "time" "github.com/juju/errors" @@ -201,6 +202,9 @@ func (b *Backoffer) WithVars(vars *kv.Variables) *Backoffer { // Backoff sleeps a while base on the backoffType and records the error message. // It returns a retryable error if total sleep time exceeds maxSleep. func (b *Backoffer) Backoff(typ backoffType, err error) error { + if strings.Contains(err.Error(), mismatchClusterID) { + log.Fatalf("critical error %v", err) + } select { case <-b.ctx.Done(): return errors.Trace(err) diff --git a/store/tikv/error.go b/store/tikv/error.go index 54c48bfa2971e..467d346d146fc 100644 --- a/store/tikv/error.go +++ b/store/tikv/error.go @@ -24,6 +24,9 @@ var ( ErrBodyMissing = errors.New("response body is missing") ) +// mismatchClusterID represents the message that the cluster ID of the PD client does not match the PD. +const mismatchClusterID = "mismatch cluster id" + // TiDB decides whether to retry transaction by checking if error message contains // string "try again later" literally. // In TiClient we use `errors.Annotate(err, txnRetryableMark)` to direct TiDB to