Retry aborted transactions on Spanner. (#103289)

* Retry aborted transactions on Spanner.
This commit is contained in:
Peter Štibraný
2025-04-03 16:26:09 +02:00
committed by GitHub
parent f5beba1036
commit 413378dd3a
6 changed files with 69 additions and 39 deletions
+9
View File
@@ -11,6 +11,7 @@ import (
"regexp"
"strings"
sqlite "github.com/mattn/go-sqlite3"
"xorm.io/core"
)
@@ -474,6 +475,14 @@ func (db *sqlite3) Filters() []core.Filter {
return []core.Filter{&core.IdFilter{}}
}
func (db *sqlite3) RetryOnError(err error) bool {
var sqlError sqlite.Error
if errors.As(err, &sqlError) && (sqlError.Code == sqlite.ErrLocked || sqlError.Code == sqlite.ErrBusy) {
return true
}
return false
}
type sqlite3Driver struct {
}