Skip to content

feat(spanner): support read-only BeginTransaction request options#5785

Open
olavloite wants to merge 3 commits into
googleapis:mainfrom
olavloite:spanner-read-only-begin-request-options
Open

feat(spanner): support read-only BeginTransaction request options#5785
olavloite wants to merge 3 commits into
googleapis:mainfrom
olavloite:spanner-read-only-begin-request-options

Conversation

@olavloite
Copy link
Copy Markdown
Contributor

Adds support for setting GAX request options for the BeginTransaction RPC call for read-only transactions. These options are only used if the transaction uses the ExplicitBegin transaction option.

Updates #4972

Adds support for setting GAX request options for the BeginTransaction RPC call
for read-only transactions. These options are only used if the transaction uses
the ExplicitBegin transaction option.

Updates googleapis#4972
@olavloite olavloite requested review from a team as code owners May 29, 2026 10:29
@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 introduces configuration options (attempt timeout, retry policy, and backoff policy) for the BeginTransaction RPC in read-only transactions. The review feedback highlights a critical regression where initializing these options to a default value by default causes the fallback mechanism to discard custom query-level options. The reviewer suggests changing the options field to an Option type initialized to None, lazily initializing it only when explicitly configured, and updating the corresponding tests.

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

codecov Bot commented May 29, 2026

Codecov Report

❌ Patch coverage is 99.70501% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 97.89%. Comparing base (73cd277) to head (3b7e5d1).

Files with missing lines Patch % Lines
src/spanner/src/read_only_transaction.rs 99.70% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5785      +/-   ##
==========================================
+ Coverage   97.88%   97.89%   +0.01%     
==========================================
  Files         226      226              
  Lines       56465    56801     +336     
==========================================
+ Hits        55273    55608     +335     
- Misses       1192     1193       +1     

☔ 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 configuration options for the BeginTransaction RPC in read-only transactions, allowing users to customize attempt timeouts, retry policies, and backoff policies. A review comment points out that when custom transaction-level options are configured, they completely overwrite statement-specific fallback options (such as custom timeouts) instead of merging with them. The reviewer suggests merging the options to avoid discarding statement-specific configurations.

Comment thread src/spanner/src/read_only_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 the ability to configure custom request options (such as attempt timeouts, retry policies, and backoff policies) specifically for the BeginTransaction RPC in read-only transactions. It adds builder methods to MultiUseReadOnlyTransactionBuilder to set these options, merges them with statement-level options during fallback explicit begins, and includes comprehensive unit tests to verify the behavior. There are no review comments to address, and the implementation is clean, well-tested, and adheres to the repository's style guidelines.

@olavloite olavloite force-pushed the spanner-read-only-begin-request-options branch from 1f3c34b to 3b7e5d1 Compare May 29, 2026 13:16
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.

1 participant