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): support mutation only operation for read-write mux #11342

Merged
merged 5 commits into from
Jan 2, 2025

Conversation

rahul2393
Copy link
Contributor

@rahul2393 rahul2393 commented Dec 23, 2024

The following describes the case when a read-write transaction is executed on a multiplexed session and this PR handles this scenario:

If a read-write transaction contains only mutations, a random mutation is selected from the mutation list and sent with the BeginTransactionRequest. The resulting Transaction response includes a precommit token, which is tracked by the client library and used in the subsequent CommitRequest

@rahul2393 rahul2393 requested review from a team as code owners December 23, 2024 09:13
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label Dec 23, 2024
Copy link
Contributor

@harshachinta harshachinta left a comment

Choose a reason for hiding this comment

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

Changes LGTM. Requested for couple of tests to verify negative scenarios

spanner/transaction.go Outdated Show resolved Hide resolved
spanner/internal/testutil/inmem_spanner_server.go Outdated Show resolved Hide resolved
spanner/transaction_test.go Show resolved Hide resolved
{"Only Query", true, false, false, false, "PartialResultSetPrecommitToken", 3},
{"Query and Update", true, true, false, false, "ResultSetPrecommitToken", 4},
{"Query, Update, and Batch Update", true, true, true, false, "ExecuteBatchDmlResponsePrecommitToken", 5},
{"Only Mutations", false, false, false, true, "BeginTransactionPrecommitToken", 1},
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a negative test scenario also?
i.e when a Commit RPC returns aborted then the retry should set mutation key and the commit request should have latest precommit token
https://github.com/harshachinta/java-spanner/blob/01c03144134febfb3c83e1bc80a7533f53f067ba/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MultiplexedSessionDatabaseClientMockServerTest.java#L1140

spanner/transaction_test.go Show resolved Hide resolved
spanner/mutation.go Outdated Show resolved Hide resolved
@rahul2393 rahul2393 requested a review from olavloite December 27, 2024 09:47
@rahul2393 rahul2393 enabled auto-merge (squash) January 2, 2025 06:16
@rahul2393 rahul2393 merged commit 7f81daf into main Jan 2, 2025
9 checks passed
@rahul2393 rahul2393 deleted the mux-rw-mutations branch January 2, 2025 09:28
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