Skip to content

Commit 1a4f4fd

Browse files
authored
fix: fix potential unnecessary transaction retry (#337)
A transaction could in some circumstances be retried after an abort using the previous transaction id. This would cause the retry to abort directly as well, and then start a new transaction. This extra loop has now been removed. Fixes #327
1 parent 26be103 commit 1a4f4fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ private <T> T runInternal(final TransactionCallable<T> txCallable) {
654654
new Callable<T>() {
655655
@Override
656656
public T call() {
657-
if (txn.isAborted()) {
657+
if (attempt.get() > 0) {
658658
txn = session.newTransaction();
659659
}
660660
checkState(

0 commit comments

Comments
 (0)