Repository navigation
fix(datastore): pass retry and timeout to begin when commit starts the transaction - #18939
Open
abhishekacharya200 wants to merge 1 commit into
Open
abhishekacharya200 wants to merge 1 commit into
abhishekacharya200 wants to merge 1 commit into
Conversation
…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.
Contributor
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #18938
With
begin_later=True, a transaction that only staged writes starts insidecommit(), and thatself.begin()call didn't receive theretryandtimeoutgiven tocommit. 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, becausebeginalready takesNonefor both.Added
test_transaction_commit_w_begin_later_w_retry_w_timeout, which fails onmainand passes with this change.test_transaction_commit_no_beginmockedbeginwith 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.