Skip to content

Commit f3b49a5

Browse files
committed
chore(spanner): throw aborted
1 parent 829f7db commit f3b49a5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ public TransactionContextFutureImpl beginAsync() {
8080
}
8181

8282
private ApiFuture<TransactionContext> internalBeginAsync(boolean firstAttempt) {
83+
if (!firstAttempt) {
84+
Preconditions.checkState(
85+
txnState == TransactionState.ABORTED,
86+
"resetForRetry can only be called after the transaction aborted.");
87+
}
8388
txnState = TransactionState.STARTED;
8489

8590
// Determine the latest transactionId when using a multiplexed session.

0 commit comments

Comments
 (0)