Skip to content

fix(datastore): resolve data race on transaction state - #12912

Merged
bhshkh merged 1 commit into
googleapis:mainfrom
bhshkh:fix/ds-beginlater-fixes
Oct 2, 2025
Merged

bhshkh merged 1 commit into
googleapis:mainfrom
bhshkh:fix/ds-beginlater-fixes

Conversation

@bhshkh

@bhshkh bhshkh commented Sep 17, 2025 •

Copy link
Copy Markdown
Contributor

Refactors the state locking for BeginLater transactions. This change:

  • Removes the racy stateLockDeferUnlock function.

  • Ensures all reads and writes to t.state and t.id are protected by t.stateLock.

  • Fixes a related logic bug where a transaction's ID was ignored if the first read operation (like Get or Run) returned an ErrNoSuchEntity.

Fixes: #11038

@bhshkh
bhshkh requested review from a team September 17, 2025 21:13
@product-auto-label product-auto-label Bot added the api: datastore Issues related to the Datastore API. label Sep 17, 2025
@bhshkh
bhshkh force-pushed the fix/ds-beginlater-fixes branch from 463fa9e to cc08883 Compare September 17, 2025 21:36
@bhshkh
bhshkh enabled auto-merge (squash) September 17, 2025 23:19
@bhshkh
bhshkh disabled auto-merge September 22, 2025 20:53
@bhshkh
bhshkh enabled auto-merge (squash) October 2, 2025 02:28
@bhshkh
bhshkh merged commit 011b148 into googleapis:main Oct 2, 2025
9 checks passed
@bhshkh
bhshkh deleted the fix/ds-beginlater-fixes branch October 2, 2025 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: datastore Issues related to the Datastore API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

datastore: Potential bugs in BeginLater implementation in v1.19.0

2 participants