fix(spanner): do not execute queued queries on ended transactions - #9305
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request modifies how waiting requests are handled when a transaction ends by directly clearing the _waitingRequests array, and adds a corresponding test. However, simply clearing the array causes queued queries to hang indefinitely because their callbacks or promises are never resolved or rejected. The feedback recommends iterating through the queued requests and failing them with an appropriate error, and updating the test to assert that the callback for the discarded query is invoked with an error.
sakthivelmanii
approved these changes
Sep 14, 2026
When multiple queries run concurrently on an unbegun read-write transaction, subsequent queries are queued while the first query executes with an inline begin. If the transaction ends or aborts before an inline transaction ID is established, queued queries should be discarded. Calling _releaseWaitingRequests() during end() mistakenly executed those waiting requests against Spanner on an already ended transaction. This removes that call from end() and clears the queue.
olavloite
force-pushed
the
spanner-skip-queries-on-ended-tx
branch
from
September 14, 2026 13:29
632f230 to
b81bf68
Compare
danieljbruce
pushed a commit
that referenced
this pull request
Sep 14, 2026
🤖 I have created a release *beep* *boop* --- ## [8.13.0](spanner-v8.12.0...spanner-v8.13.0) (2026-09-14) ### Features * PNPM workspace ([#8973](#8973)) ([1ea27c9](1ea27c9)) ### Bug Fixes * **spanner:** Do not execute queued queries on ended transactions ([#9305](#9305)) ([f74f198](f74f198)) ### Performance Improvements * **spanner:** Avoid cloning metadata map in metrics interceptor ([#9307](#9307)) ([6eec761](6eec761)) * **spanner:** Avoid redundant clock reads in isGlobalTracingEnabled ([#9311](#9311)) ([c42f144](c42f144)) * **spanner:** Bypass stream pipeline for single-chunk query results ([#9279](#9279)) ([e46a407](e46a407)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
thiyaguk09
pushed a commit
to thiyaguk09/google-cloud-node-fork
that referenced
this pull request
Sep 15, 2026
🤖 I have created a release *beep* *boop* --- ## [8.13.0](googleapis/google-cloud-node@spanner-v8.12.0...spanner-v8.13.0) (2026-09-14) ### Features * PNPM workspace ([googleapis#8973](googleapis#8973)) ([1ea27c9](googleapis@1ea27c9)) ### Bug Fixes * **spanner:** Do not execute queued queries on ended transactions ([googleapis#9305](googleapis#9305)) ([f74f198](googleapis@f74f198)) ### Performance Improvements * **spanner:** Avoid cloning metadata map in metrics interceptor ([googleapis#9307](googleapis#9307)) ([6eec761](googleapis@6eec761)) * **spanner:** Avoid redundant clock reads in isGlobalTracingEnabled ([googleapis#9311](googleapis#9311)) ([c42f144](googleapis@c42f144)) * **spanner:** Bypass stream pipeline for single-chunk query results ([googleapis#9279](googleapis#9279)) ([e46a407](googleapis@e46a407)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When multiple queries run concurrently on an unbegun read-write transaction, subsequent queries are queued while the first query executes with an inline begin.
If the transaction ends or aborts before an inline transaction ID is established, queued queries should be discarded. Calling _releaseWaitingRequests() during end() mistakenly executed those waiting requests against Spanner on an already ended transaction. This removes that call from end() and clears the queue.