-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Conversation
6af69d6
to
0cf30f8
Compare
0cf30f8
to
0da574c
Compare
There was a problem hiding this 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_test.go
Outdated
{"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}, |
There was a problem hiding this comment.
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
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