-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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): add change streams transaction exclusion sample #5071
base: main
Are you sure you want to change the base?
feat(spanner): add change streams transaction exclusion sample #5071
Conversation
Here is the summary of changes. You are about to add 1 region tag.
This comment is generated by snippet-bot.
|
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.
Hi team,
I'm currently reviewing this pull request and will provide my feedback shortly. In the meantime, here's a summary for you and other reviewers to quickly get up to speed:
This pull request, authored by ShuranZhang, aims to add a sample demonstrating how to configure the transaction exclusion option for change streams in Spanner read-write transactions. Specifically, it adds a new sample that shows how to exclude a read-write transaction from being tracked by change streams.
Here's a breakdown of the changes:
- New File:
spanner/spanner_snippets/spanner/spanner_change_streams_txn_exclusion.go
This file contains the new sample code that demonstrates how to exclude a read-write transaction from change streams usingspanner.TransactionOptions{ExcludeTxnFromChangeStreams: true}
. The code inserts and updates a row in theSingers
table within a transaction, and then prints confirmation messages to the console. - Modified File:
spanner/spanner_snippets/spanner/integration_test.go
This file has been updated to include a test case for the newrwTxnExcludedFromChangeStreams
function (lines 437-443). This test verifies that the transaction is correctly excluded from change streams by asserting that specific messages are present in the output.
The changes are well-structured and clearly demonstrate the intended functionality. The comments are helpful and the code is easy to follow.
And now, a little haiku to lighten the mood:
Streams flow, data bright,
Transactions, neatly kept,
Code review's delight.
Thanks,
Gemini
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 sample demonstrates how to exclude read-write transactions from change streams. The code is well-structured and easy to understand. The PR description could be improved by adding a link to the documentation.
spanner/spanner_snippets/spanner/spanner_change_streams_txn_exclusion.go
Outdated
Show resolved
Hide resolved
spanner/spanner_snippets/spanner/spanner_change_streams_txn_exclusion.go
Show resolved
Hide resolved
spanner/spanner_snippets/spanner/spanner_change_streams_txn_exclusion.go
Outdated
Show resolved
Hide resolved
spanner/spanner_snippets/spanner/spanner_change_streams_txn_exclusion.go
Show resolved
Hide resolved
spanner/spanner_snippets/spanner/spanner_change_streams_txn_exclusion.go
Show resolved
Hide resolved
77c1062
to
e08718d
Compare
Add sample for how to configure change streams transaction exclusion option for a read write transaction.
I don't have access to re-open #4108, this is basically a duplicate.