Skip to content
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): handle commit retry protocol extension for mux rw #11472

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rahul2393
Copy link
Contributor

In a read-write transaction using a multiplexed session with (read/query + mutation) operations, the CommitResponse from the backend during the commit RPC may include a MultiplexedSessionRetry field (indicated by a precommit token). This field signals that the commit RPC should be retried once using the new precommit token. During this retry, mutations should not be resent, as they were already buffered in spanFE during the initial commit RPC call.

@rahul2393 rahul2393 requested review from a team as code owners January 20, 2025 09:11
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label Jan 20, 2025
@rahul2393 rahul2393 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 20, 2025
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 20, 2025
@rahul2393 rahul2393 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 21, 2025
return resp, t.txReadOnly.updateTxState(toSpannerErrorWithCommitInfo(err, true))
}
// Retry if MultiplexedSessionRetry is present, without mutations
if res.GetMultiplexedSessionRetry() != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Here can we get the precommit token, pass it to setPrecommitToken method and then below use t.precommittoken?
I understand that the precommittoken reveived in res should be latest but here we will need to rely on sequence number to determine that the precommit token is indeed latest. This will save us in future in cases where the precommit token received in res could be outdated.

Comment on lines +559 to +560
if _, err := tx.Update(ctx, Statement{SQL: UpdateBarSetFoo}); err != nil {
return err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit retry only happens in cases of DQL+Mutation. Lets remove DML to avoid confusion

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 Spanner API. kokoro:force-run Add this label to force Kokoro to re-run the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants