Skip to content

Commit

Permalink
meta/sql: retry txn for mariadb when conflict (#5440)
Browse files Browse the repository at this point in the history
Signed-off-by: jiefenghuang <[email protected]>
  • Loading branch information
jiefenghuang authored Dec 27, 2024
1 parent b8eadbc commit 3d198ad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/meta/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,9 @@ func (m *dbMeta) shouldRetry(err error) bool {
return errors.Is(err, errBusy) || strings.Contains(msg, "database is locked")
case "mysql":
// MySQL, MariaDB or TiDB
// error 1020 for MariaDB when conflict
return strings.Contains(msg, "try restarting transaction") || strings.Contains(msg, "try again later") ||
strings.Contains(msg, "duplicate entry")
strings.Contains(msg, "duplicate entry") || strings.Contains(msg, "error 1020 (hy000)")
case "postgres":
return strings.Contains(msg, "current transaction is aborted") || strings.Contains(msg, "deadlock detected") ||
strings.Contains(msg, "duplicate key value") || strings.Contains(msg, "could not serialize access") ||
Expand Down

0 comments on commit 3d198ad

Please sign in to comment.