-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(spanner): fix mutation only case in rw mux with aborted error #3571
Merged
harshachinta
merged 9 commits into
googleapis:main
from
harshachinta:mutation-only-inline-begin
Jan 30, 2025
Merged
chore(spanner): fix mutation only case in rw mux with aborted error #3571
harshachinta
merged 9 commits into
googleapis:main
from
harshachinta:mutation-only-inline-begin
Jan 30, 2025
Conversation
This file contains 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
product-auto-label
bot
added
size: l
Pull request size is large.
api: spanner
Issues related to the googleapis/java-spanner API.
labels
Dec 26, 2024
harshachinta
changed the title
chore(spanner): fix mutation only case ibn rw using mux with aborted …
chore(spanner): fix mutation only case inn rw using mux with aborted …
Dec 26, 2024
harshachinta
changed the title
chore(spanner): fix mutation only case inn rw using mux with aborted …
chore(spanner): fix mutation only case in rw using mux with aborted …
Dec 26, 2024
harshachinta
changed the title
chore(spanner): fix mutation only case in rw using mux with aborted …
chore(spanner): fix mutation only case in rw mux with aborted error
Dec 26, 2024
Is this something that can actually happen? |
olavloite
reviewed
Dec 27, 2024
google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java
Outdated
Show resolved
Hide resolved
google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java
Outdated
Show resolved
Hide resolved
...r/src/test/java/com/google/cloud/spanner/MultiplexedSessionDatabaseClientMockServerTest.java
Outdated
Show resolved
Hide resolved
...r/src/test/java/com/google/cloud/spanner/MultiplexedSessionDatabaseClientMockServerTest.java
Outdated
Show resolved
Hide resolved
...r/src/test/java/com/google/cloud/spanner/MultiplexedSessionDatabaseClientMockServerTest.java
Outdated
Show resolved
Hide resolved
Yes, this can happen if backend is unable to refresh the schema when a mutation key is passed with a BeginTransaction RPC. |
product-auto-label
bot
added
size: m
Pull request size is medium.
and removed
size: l
Pull request size is large.
labels
Jan 30, 2025
Thanks @olavloite. Updated the approach to solve this problem by following the commit |
olavloite
approved these changes
Jan 30, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
api: spanner
Issues related to the googleapis/java-spanner API.
size: m
Pull request size is medium.
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.
This PR fixes the following scenario.
In a mutation-only scenario for a read-write transaction using multiplexed sessions, an explicit BeginTransaction RPC is triggered after the user operation completes.
However, if an ABORT occurs during this BeginTransaction RPC (this can happen if backend is unable to refresh the schema when a mutation key is passed), the client retry mechanism performs an explicit BeginTransaction before the user operation begins. This behavior causes issues in multiplexed sessions because, in mutation-only cases, the BeginTransaction requires a mutation key to generate a precommit token. This precommit token is essential for committing the transaction.
Currently, since the BeginTransaction during a retry is executed before the user operation, no mutation key is available, and consequently, no precommit token is included in the transaction response. This leads to commit failures with an error as shown below
Fix: The fix involves retrying the BeginTransaction RPC for mutation-only cases with multiplexed sessions when it fails with ABORTED error.