-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(spanner): add ResetForRetry method for stmt-based transactions (#…
…10956) * feat(spanner): add ResetForRetry method for stmt-based transactions Read/write transactions that are aborted should preferably be retried using the same session as the original attempt. For this, statement-based transactions should have a ResetForRetry function. This was missing in the Go client library. This change adds this method, and re-uses the session when possible. If the aborted error happens during the Commit RPC, the session handle was already cleaned up by the original implementation. We will not change that now, as that could lead to breakage in existing code that depends on this. When the Go client is switched to multiplexed sessions for read/write transactions, then this implementation should be re-visited, and it should be made sure that ResetForRetry optimizes the retry attempt for an actual retry. Updates googleapis/go-sql-spanner#300 * fix: only allow resetting if tx is really aborted --------- Co-authored-by: Sri Harsha CH <[email protected]>
- Loading branch information
1 parent
5b59819
commit 02c191c
Showing
3 changed files
with
180 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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