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): track precommit token for R/W multiplexed session #11229

Merged
merged 9 commits into from
Dec 23, 2024

Conversation

rahul2393
Copy link
Contributor

@rahul2393 rahul2393 commented Dec 5, 2024

When a read-write transaction is executed on a multiplexed session, the RPC responses of that transaction return a MultiplexedSessionPrecommitToken. In client library, the precommit token with the highest sequence number is tracked at the transaction context level. During the commit, this latest precommit token is fetched and set in the CommitRequest. If the precommit token is not set during the commit, the backend will throw an INVALID_ARGUMENT error.

Including the latest token in the CommitRequest is essential to prevent latency regression, though it does not impact the correctness of the transaction.

This PR tracks the precommit token from the following RPC responses,

  • ResultSet
  • PartialResultSet
  • ExecuteBatchDmlResponse

@rahul2393 rahul2393 requested review from a team as code owners December 5, 2024 05:21
@rahul2393 rahul2393 marked this pull request as draft December 5, 2024 05:21
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label Dec 5, 2024
@rahul2393 rahul2393 marked this pull request as ready for review December 11, 2024 06:04
@harshachinta harshachinta self-requested a review December 16, 2024 06:30
@rahul2393 rahul2393 changed the title feat(spanner): add support for multiplexed session with read write transactions chore(spanner): add support for multiplexed session with read write transactions Dec 18, 2024
@rahul2393 rahul2393 force-pushed the rw_mux_support branch 5 times, most recently from ef5e044 to 3b75ad7 Compare December 18, 2024 11:36
spanner/client.go Outdated Show resolved Hide resolved
spanner/transaction.go Show resolved Hide resolved
spanner/session.go Outdated Show resolved Hide resolved
spanner/session.go Outdated Show resolved Hide resolved
spanner/session.go Outdated Show resolved Hide resolved
spanner/session.go Outdated Show resolved Hide resolved
spanner/internal/testutil/inmem_spanner_server.go Outdated Show resolved Hide resolved
spanner/internal/testutil/inmem_spanner_server.go Outdated Show resolved Hide resolved
spanner/internal/testutil/inmem_spanner_server.go Outdated Show resolved Hide resolved
spanner/client.go Outdated Show resolved Hide resolved
spanner/client.go Outdated Show resolved Hide resolved
spanner/client.go Outdated Show resolved Hide resolved
spanner/transaction_test.go Outdated Show resolved Hide resolved
spanner/transaction_test.go Show resolved Hide resolved
@rahul2393 rahul2393 force-pushed the rw_mux_support branch 2 times, most recently from 7561e70 to 9dca2e8 Compare December 20, 2024 12:42
@harshachinta harshachinta changed the title chore(spanner): add support for multiplexed session with read write transactions chore(spanner): track precommit token for R/W multiplexed session Dec 21, 2024
@rahul2393 rahul2393 merged commit e9a8e3a into main Dec 23, 2024
9 checks passed
@rahul2393 rahul2393 deleted the rw_mux_support branch December 23, 2024 05:39
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants