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
+6
View File
@@ -8,10 +8,12 @@ import (
"strconv"
"strings"
spannerclient "cloud.google.com/go/spanner"
_ "github.com/googleapis/go-sql-spanner"
spannerdriver "github.com/googleapis/go-sql-spanner"
"google.golang.org/api/option"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials/insecure"
"xorm.io/core"
)
@@ -425,3 +427,7 @@ func SpannerConnectorConfigToClientOptions(connectorConfig spannerdriver.Connect
}
return opts
}
func (s *spanner) RetryOnError(err error) bool {
return err != nil && spannerclient.ErrCode(spannerclient.ToSpannerError(err)) == codes.Aborted
}