Skip to content

feat(spanner): add gax options for read/write transactions#5787

Merged
olavloite merged 7 commits into
googleapis:mainfrom
olavloite:spanner-gax-options-for-read-write-tx
May 29, 2026
Merged

feat(spanner): add gax options for read/write transactions#5787
olavloite merged 7 commits into
googleapis:mainfrom
olavloite:spanner-gax-options-for-read-write-tx

Conversation

@olavloite
Copy link
Copy Markdown
Contributor

Adds methods for configuring GAX RequestOptions for the BeginTransaction and Commit RPCs of read/write transactions.

Updates #4972

Adds methods for configuring GAX RequestOptions for the BeginTransaction and Commit
RPCs of read/write transactions.

Updates googleapis#4972
@olavloite olavloite requested review from a team as code owners May 29, 2026 12:33
@product-auto-label product-auto-label Bot added the api: spanner Issues related to the Spanner API. label May 29, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enables configuring GAX request options (such as attempt timeouts, retry policies, and backoff policies) for both the BeginTransaction and Commit RPCs in read-write transactions. It introduces new builder methods on TransactionRunnerBuilder and ReadWriteTransactionBuilder to set these options, refactors option amendment logic, and adds comprehensive unit tests. The reviewer suggested an optimization in amend_gax_options to use std::mem::take instead of cloning GaxRequestOptions to avoid unnecessary allocations.

Comment thread src/spanner/src/read_write_transaction.rs Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

❌ Patch coverage is 97.11340% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.88%. Comparing base (f075cec) to head (2247cf3).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/spanner/src/read_write_transaction.rs 96.61% 14 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #5787    +/-   ##
========================================
  Coverage   97.87%   97.88%            
========================================
  Files         226      226            
  Lines       56496    56938   +442     
========================================
+ Hits        55298    55731   +433     
- Misses       1198     1207     +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@olavloite
Copy link
Copy Markdown
Contributor Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces configurable request options (begin_gax_options and commit_gax_options) for BeginTransaction and Commit RPCs in ReadWriteTransactionBuilder and ReadWriteTransaction, along with corresponding builder methods in TransactionRunnerBuilder. It also refactors amend_gax_options into a standalone helper function and adds extensive unit tests. Feedback highlights that TransactionBoundedRetryPolicy does not delegate on_throttle to its inner policy, which would cause custom throttling behaviors to be silently ignored, and suggests implementing delegation for on_throttle.

Comment thread src/spanner/src/read_write_transaction.rs
@olavloite
Copy link
Copy Markdown
Contributor Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds configurable GAX request options (including timeouts, retry policies, and backoff policies) for the BeginTransaction and Commit RPCs in read-write transactions. It introduces several builder methods to TransactionRunnerBuilder and ReadWriteTransactionBuilder, refactors GAX options amendment, and adds comprehensive unit tests. Feedback is provided to improve the TransactionBoundedRetryPolicy's remaining_time implementation so that it respects any shorter timeout defined by the wrapped inner retry policy.

Comment thread src/spanner/src/read_write_transaction.rs Outdated
@olavloite
Copy link
Copy Markdown
Contributor Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces configurable GAX request options (such as attempt timeouts, retry policies, and backoff policies) for both the BeginTransaction and Commit RPCs within read-write transactions. It updates ReadWriteTransactionBuilder and TransactionRunnerBuilder with fluent builder methods to set these options, refactors the GAX options amendment logic to correctly respect and cap timeouts based on the transaction deadline, and adds comprehensive unit tests to verify the new behaviors. No review comments were provided, and the implementation is clean and idiomatic.

Comment thread src/spanner/src/read_write_transaction.rs
@olavloite olavloite enabled auto-merge (squash) May 29, 2026 17:03
@olavloite olavloite merged commit 55c309b into googleapis:main May 29, 2026
40 checks passed
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