Skip to content

fix(datastore): pass retry and timeout to begin when commit starts the transaction - #18939

Open
abhishekacharya200 wants to merge 1 commit into
googleapis:mainfrom
abhishekacharya200:fix/datastore-commit-begin-timeout
Open

abhishekacharya200 wants to merge 1 commit into
googleapis:mainfrom
abhishekacharya200:fix/datastore-commit-begin-timeout

Conversation

@abhishekacharya200

Copy link
Copy Markdown
Contributor

Fixes #18938

With begin_later=True, a transaction that only staged writes starts inside commit(), and that self.begin() call didn't receive the retry and timeout given to commit. So the BeginTransaction request ignored them while the Commit right after it used them.

This passes both on to begin. Callers who pass neither see no change, because begin already takes None for both.

Added test_transaction_commit_w_begin_later_w_retry_w_timeout, which fails on main and passes with this change. test_transaction_commit_no_begin mocked begin with no arguments, so it now accepts and checks them. The package's unit tests pass locally, and the noxfile's ruff 0.14.14 checks and flake8 report nothing on the changed files.

…e transaction

A transaction with begin_later that reaches commit without a read starts
there, and that begin request ignored the retry and timeout given to
commit.
@abhishekacharya200
abhishekacharya200 requested a review from a team as a code owner October 31, 2026 13:42

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

Copy link
Copy Markdown
Contributor

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 updates the commit method in google/cloud/datastore/transaction.py to forward the retry and timeout parameters to self.begin() when a transaction is started lazily. It also adds a corresponding unit test to verify this behavior and updates existing tests to accommodate the signature change. I have no feedback to provide on these changes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

datastore: Transaction.commit drops retry and timeout when it begins the transaction

1 participant