Skip to content

Commit 606c052

Browse files
committed
chore(spanner): fix mock server for background request
1 parent 8a3b6fb commit 606c052

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

google-cloud-spanner/src/test/java/com/google/cloud/spanner/MockSpannerServiceImpl.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,16 +1925,17 @@ private Transaction beginTransaction(
19251925
}
19261926
Transaction transaction = builder.build();
19271927
transactions.put(transaction.getId(), transaction);
1928-
// Do not add transaction id to transactionsStarted if this request was from background thread
1928+
// TODO: remove once UNIMPLEMENTED error is not thrown for read-write mux
1929+
// Do not consider the transaction if this request was from background thread
19291930
if (requestOptions == null
19301931
|| !requestOptions.getTransactionTag().equals("multiplexed-rw-background-begin-txn")) {
19311932
transactionsStarted.add(transaction.getId());
1933+
if (abortNextTransaction.getAndSet(false)) {
1934+
markAbortedTransaction(transaction.getId());
1935+
}
19321936
}
19331937
isPartitionedDmlTransaction.put(
19341938
transaction.getId(), options.getModeCase() == ModeCase.PARTITIONED_DML);
1935-
if (abortNextTransaction.getAndSet(false)) {
1936-
markAbortedTransaction(transaction.getId());
1937-
}
19381939
return transaction;
19391940
}
19401941

0 commit comments

Comments
 (0)