From 1eb91093a15ca0bc6bbbd5ac2382c388bb123e13 Mon Sep 17 00:00:00 2001 From: ti-srebot <66930949+ti-srebot@users.noreply.github.com> Date: Fri, 18 Feb 2022 17:21:40 +0800 Subject: [PATCH] lightning: add more retryable error type (#31484) (#31506) close pingcap/tidb#31376 --- br/pkg/utils/retry.go | 4 +++- br/pkg/utils/retry_test.go | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/br/pkg/utils/retry.go b/br/pkg/utils/retry.go index a076190b953d6..51a833d8d136c 100644 --- a/br/pkg/utils/retry.go +++ b/br/pkg/utils/retry.go @@ -117,7 +117,9 @@ func isSingleRetryableError(err error) bool { case *mysql.MySQLError: switch nerr.Number { // ErrLockDeadlock can retry to commit while meet deadlock - case tmysql.ErrUnknown, tmysql.ErrLockDeadlock, tmysql.ErrWriteConflictInTiDB, tmysql.ErrPDServerTimeout, tmysql.ErrTiKVServerTimeout, tmysql.ErrTiKVServerBusy, tmysql.ErrResolveLockTimeout, tmysql.ErrRegionUnavailable: + case tmysql.ErrUnknown, tmysql.ErrLockDeadlock, tmysql.ErrWriteConflict, tmysql.ErrWriteConflictInTiDB, + tmysql.ErrPDServerTimeout, tmysql.ErrTiKVServerTimeout, tmysql.ErrTiKVServerBusy, tmysql.ErrResolveLockTimeout, + tmysql.ErrRegionUnavailable, tmysql.ErrInfoSchemaExpired, tmysql.ErrInfoSchemaChanged, tmysql.ErrTxnRetryable: return true default: return false diff --git a/br/pkg/utils/retry_test.go b/br/pkg/utils/retry_test.go index b5c54287f1cce..0186e2314ee99 100644 --- a/br/pkg/utils/retry_test.go +++ b/br/pkg/utils/retry_test.go @@ -37,6 +37,10 @@ func (s *utilSuite) TestIsRetryableError(c *C) { c.Assert(IsRetryableError(&mysql.MySQLError{Number: tmysql.ErrResolveLockTimeout}), IsTrue) c.Assert(IsRetryableError(&mysql.MySQLError{Number: tmysql.ErrRegionUnavailable}), IsTrue) c.Assert(IsRetryableError(&mysql.MySQLError{Number: tmysql.ErrWriteConflictInTiDB}), IsTrue) + c.Assert(IsRetryableError(&mysql.MySQLError{Number: tmysql.ErrWriteConflict}), IsTrue) + c.Assert(IsRetryableError(&mysql.MySQLError{Number: tmysql.ErrInfoSchemaExpired}), IsTrue) + c.Assert(IsRetryableError(&mysql.MySQLError{Number: tmysql.ErrInfoSchemaChanged}), IsTrue) + c.Assert(IsRetryableError(&mysql.MySQLError{Number: tmysql.ErrTxnRetryable}), IsTrue) // gRPC Errors c.Assert(IsRetryableError(status.Error(codes.Canceled, "")), IsFalse)