-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Client
Spanner: v0.37.4
(But as far as I know, it also occurs when we use latest version)
Describe Your Environment
Alpine Docker on GKE
Expected Behavior
If possible, this client library should retries a transaction when it fails with Session not found
error.
Actual Behavior
We sometimes get the Session not found
errors.
This client library retries transactions only when the Abort
error occurred, so when taken session is not active, it just returns the NotFound
error to callers without retrying.
google-cloud-go/spanner/client.go
Lines 394 to 398 in e4bd323
sh, err = c.idleSessions.takeWriteSession(ctx) if err != nil { // If session retrieval fails, just fail the transaction. return err } google-cloud-go/spanner/client.go
Lines 439 to 454 in e4bd323
// Only retry on ABORTED. if isAbortErr(funcErr) { // Aborted, do exponential backoff and continue. b, ok := extractRetryDelay(funcErr) if !ok { b = backoff.DefaultBackoff.Delay(retryCount) } trace.TracePrintf(ctx, nil, "Backing off after ABORTED for %s, then retrying", b) select { case <-ctx.Done(): return errContextCanceled(ctx, funcErr) case <-time.After(b): } retryCount++ continue }
Since this library creates the pool of the sessions, I think it should retry failed transactions caused by Session not found
by taking another session. But are there any problems to take another session from the pool?