-
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
feat(spanner): support commit options in mutation operations. #10668
Conversation
94e351d
to
93c6da5
Compare
spanner/client.go
Outdated
var commitOptions CommitOptions | ||
if ao.commitOptions != nil { | ||
commitOptions = *ao.commitOptions | ||
} |
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.
I don't quite understand why this is different depending on whether ao.atLeastOnce
is true or not.
spanner/transaction.go
Outdated
// maxCommitDelay is the maximum time that the commit will be delayed by the | ||
// backend before it is acknowledged. |
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.
(The field here is not maxCommitDelay
, but commitOptions
)
// maxCommitDelay is the maximum time that the commit will be delayed by the | |
// backend before it is acknowledged. | |
// commitOptions are applied to the Commit request for the writeOnlyTransaction. |
@@ -1498,7 +1498,11 @@ func TestIntegration_ReadWriteTransaction_StatementBased(t *testing.T) { | |||
Insert("Accounts", []string{"AccountId", "Nickname", "Balance"}, []interface{}{int64(1), "Foo", int64(50)}), | |||
Insert("Accounts", []string{"AccountId", "Nickname", "Balance"}, []interface{}{int64(2), "Bar", int64(1)}), | |||
} | |||
if _, err := client.Apply(ctx, accounts, ApplyAtLeastOnce()); err != nil { | |||
duration, err := time.ParseDuration("100ms") |
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 we also add mock server tests for both normal read/write transactions and writeAtLeastOnce transactions that verify that the maxCommitDelay that has been set is actually sent to Spanner in both cases? This integration test only shows that setting the option does not break anything, it is not able to determine whether the option was actually sent or not.
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.
Added the tests
No description provided.