Skip to content

Commit

Permalink
lightning: add more retryable error type (#31484) (#31506)
Browse files Browse the repository at this point in the history
close #31376
  • Loading branch information
ti-srebot authored Feb 18, 2022
1 parent 92d6798 commit 1eb9109
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion br/pkg/utils/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions br/pkg/utils/retry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1eb9109

Please sign in to comment.