Skip to content

Fix [cloud-nio] link#3835

Merged
chingor13 merged 1 commit intogoogleapis:masterfrom
arifkasim:patch-1
Oct 19, 2018
Merged

Fix [cloud-nio] link#3835
chingor13 merged 1 commit intogoogleapis:masterfrom
arifkasim:patch-1

Conversation

@arifkasim
Copy link

Fixes #<issue_number_goes_here> (it's a good idea to open an issue first for context and/or discussion)

@arifkasim arifkasim requested a review from a team October 19, 2018 15:21
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 19, 2018
@chingor13 chingor13 merged commit d971c35 into googleapis:master Oct 19, 2018
@JesseLovelace JesseLovelace mentioned this pull request Oct 25, 2018
suztomo pushed a commit that referenced this pull request Mar 9, 2026
lqiu96 pushed a commit that referenced this pull request Mar 20, 2026
chingor13 pushed a commit that referenced this pull request Mar 24, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>2.59.2-SNAPSHOT</summary>

### Updating meta-information for bleeding-edge SNAPSHOT release.
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
chingor13 pushed a commit that referenced this pull request Mar 24, 2026
Aborted transactions should ideally be retried in the same transaction manager instance because the client library will ensure to populate the "Prev txn attempt's txn id" on retry (for mux sessions) which helps preserve the lock order(priority) of the transaction in scenarios of high contention thats causing txn wounding. This is achieved by using `resetForRetry()` that automatically takes care of preserving the lock order.

But if the customer application retries aborted transactions on a new TransactionManager instance with out using the `resetForRetry()`, we lose the lock order of the previous attempt.

To address this scenario of preserving the lockorder across transaction manger instance for a retry of the same transaction
Current proposal as per client lib team recommendation:
1. Overload the [Begin](https://togithub.com/googleapis/java-spanner/blob/702f5aa6468bb3f867032efabe685594359d79ae/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionManager.java#L62) API in the TransactionManager to accept an AbortedException argument.
2. Client library will populate the aborted transaction's transaction ID in the [AbortedException](https://togithub.com/googleapis/java-spanner/blob/877b165f2bacc52a3fb10fedf37ab02111b47a1e/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbortedException.java#L27) object which is propagated up the customer's application stack.
3. On the customer end, they will just need to pass in this AbortedException object to the "Begin" API when they retry the transaction on the new transaction manager instance.

Note: This will be a no-op for regular sessions.
b/407037309
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants