From 12c2110421a0c291b58fbaf28133c8d431e48def Mon Sep 17 00:00:00 2001 From: Olav Loite Date: Fri, 10 Jul 2020 14:45:39 +0200 Subject: [PATCH] fix: fix potential unnecessary transaction retry 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 --- .../java/com/google/cloud/spanner/TransactionRunnerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java index c10b713285..21812aa96a 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java @@ -654,7 +654,7 @@ private T runInternal(final TransactionCallable txCallable) { new Callable() { @Override public T call() { - if (txn.isAborted()) { + if (attempt.get() > 0) { txn = session.newTransaction(); } checkState(