fix(spanner): propagate previous transaction ID on inline-begin retries (#19955) ## Description Set `MultiplexedSessionPreviousTransactionId` in the transaction selector built in `ReadWriteTransaction.acquire()`, consistent with `getTransactionSelector()` and explicit `BeginTransaction`, which already set it. ## Why Multiplexed sessions do not inherit the wound-wait lock priority of the aborted transaction from the session, so every retry started with a fresh lock priority and kept losing lock conflicts. Tthis caused starvation and increased lock wait times and tail latencies. 🤖 Generated with [Claude Code](https://claude.com/claude-code) ## easy load test <details><summary>Details (Click me)</summary> use this script. https://gist.github.com/nktks/e1b354ac28bbc691527b9158ff448f1a **First two are this branch, last two are main branch.** ``` + git rev-parse --short HEAD c4d335002e + go run main.go -db $SPANNER_DATABASE 2026/06/11 11:20:51 seeded 10000 rows 2026/06/11 11:20:51 warmup 5s, then measuring for 1m0s measured duration : 60.0s committed txns : 3845 failed txns : 0 abort retries : 7585 (1.97 retries/tx) throughput : 64.1 tx/s latency mean : 505.2 ms latency p50 : 222.4 ms latency p95 : 1773.4 ms latency p99 : 2619.7 ms latency max : 3413.1 ms 2026/06/11 11:21:57 cleaned up all rows + sleep 60 + go run main.go -db $SPANNER_DATABASE 2026/06/11 11:23:00 seeded 10000 rows 2026/06/11 11:23:00 warmup 5s, then measuring for 1m0s measured duration : 60.0s committed txns : 3898 failed txns : 0 abort retries : 7659 (1.96 retries/tx) throughput : 65.0 tx/s latency mean : 493.0 ms latency p50 : 257.1 ms latency p95 : 1547.5 ms latency p99 : 2187.3 ms latency max : 4015.6 ms 2026/06/11 11:24:06 cleaned up all rows + sleep 60 + git checkout main Switched to branch 'main' Your branch is up to date with 'origin/main'. + go run main.go -db $SPANNER_DATABASE 2026/06/11 11:25:12 seeded 10000 rows 2026/06/11 11:25:12 warmup 5s, then measuring for 1m0s measured duration : 60.0s committed txns : 3374 failed txns : 0 abort retries : 5833 (1.73 retries/tx) throughput : 56.2 tx/s latency mean : 565.3 ms latency p50 : 151.0 ms latency p95 : 2154.8 ms latency p99 : 6289.1 ms latency max : 21532.6 ms 2026/06/11 11:26:19 cleaned up all rows + sleep 60 + go run main.go -db $SPANNER_DATABASE 2026/06/11 11:27:23 seeded 10000 rows 2026/06/11 11:27:23 warmup 5s, then measuring for 1m0s measured duration : 60.0s committed txns : 3333 failed txns : 0 abort retries : 5827 (1.75 retries/tx) throughput : 55.5 tx/s latency mean : 572.4 ms latency p50 : 174.3 ms latency p95 : 2271.1 ms latency p99 : 5169.9 ms latency max : 14900.8 ms 2026/06/11 11:28:31 cleaned up all rows ``` ### Cloud Monitoring metrics (Sorry my console is japanease...) <img width="1220" height="454" alt="image" src="https://github.com/user-attachments/assets/0235aabd-bf3a-43e6-93c4-403912ce80f3" /> <img width="1211" height="470" alt="image" src="https://github.com/user-attachments/assets/830226bf-7e5e-4023-96fc-9d8f4630993a" /> <img width="612" height="451" alt="image" src="https://github.com/user-attachments/assets/c65c08fd-c4b4-4d11-b3bf-beab038e36cc" /> </details>
Go packages for Google Cloud Platform services.
go get cloud.google.com/go/firestore@latest # Replace firestore with the package you want to use.
NOTE: Some of these packages are under development, and may occasionally make backwards-incompatible changes.
For an updated list of all of our released APIs please see our reference docs.
Our libraries are compatible with the two most recent major Go releases, the same policy the Go programming language follows. This means the currently supported versions are:
By default, each client library will use Application Default Credentials (ADC) to automatically configure the credentials used in calling the API endpoint. When using the libraries in a Google Cloud Platform environment such as Compute Engine, Kubernetes Engine, or App Engine, no additional authentication steps are necessary. See Authentication methods at Google and Authenticate for using client libraries for more information.
client, err := storage.NewClient(ctx)
For applications running elsewhere, such as your local development environment, you can use the gcloud auth application-default login command from the Google Cloud CLI to set user credentials in your local filesystem. Application Default Credentials will automatically detect these credentials. See Set up ADC for a local development environment for more information.
Alternately, you may need to provide an explicit path to your credentials. To authenticate using a service account key file, either set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the path to your key file, or programmatically pass option.WithCredentialsFile to the NewClient function of the desired package. For example:
client, err := storage.NewClient(ctx, option.WithCredentialsFile("path/to/keyfile.json"))
You can exert even more control over authentication by using the credentials package to create an auth.Credentials. Then pass option.WithAuthCredentials to the NewClient function:
creds, err := credentials.DetectDefault(&credentials.DetectOptions{...})
...
client, err := storage.NewClient(ctx, option.WithAuthCredentials(creds))
Contributions are welcome. Please, see the CONTRIBUTING document for details.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See Contributor Code of Conduct for more information.