@@ -608,6 +608,7 @@ private static void checkStreamException(
608608 private final AtomicBoolean abortNextStatement = new AtomicBoolean ();
609609 private final AtomicBoolean ignoreNextInlineBeginRequest = new AtomicBoolean ();
610610 private ConcurrentMap <String , AtomicLong > transactionCounters = new ConcurrentHashMap <>();
611+ private ConcurrentMap <String , String > transactionToTrace = new ConcurrentHashMap <>();
611612 private ConcurrentMap <String , List <ByteString >> partitionTokens = new ConcurrentHashMap <>();
612613 private ConcurrentMap <ByteString , Instant > transactionLastUsed = new ConcurrentHashMap <>();
613614
@@ -650,6 +651,7 @@ private ByteString generateTransactionName(String session) {
650651 counter = new AtomicLong ();
651652 transactionCounters .put (session , counter );
652653 }
654+ transactionToTrace .put (session , Arrays .toString (Thread .currentThread ().getStackTrace ()));
653655 return ByteString .copyFromUtf8 (
654656 String .format ("%s/transactions/%d" , session , counter .incrementAndGet ()));
655657 }
@@ -1012,6 +1014,7 @@ void doDeleteSession(Session session) {
10121014 removeSession (session .getName ());
10131015 transactionCounters .remove (session .getName ());
10141016 sessionLastUsed .remove (session .getName ());
1017+ transactionToTrace .remove (session .getName ());
10151018 }
10161019
10171020 @ Override
@@ -1989,6 +1992,9 @@ private void ensureMostRecentTransaction(Session session, ByteString transaction
19891992 if (index > -1 ) {
19901993 long id = Long .parseLong (transactionId .toStringUtf8 ().substring (index + 1 ));
19911994 if (id != counter .get ()) {
1995+ System .out .println (transactionId .toStringUtf8 ());
1996+ System .out .println (session .getName ());
1997+ System .out .println (transactionToTrace .get (session .getName ()));
19921998 throw Status .FAILED_PRECONDITION
19931999 .withDescription (
19942000 String .format (
@@ -2351,6 +2357,7 @@ public void reset() {
23512357 isPartitionedDmlTransaction = new ConcurrentHashMap <>();
23522358 abortedTransactions = new ConcurrentHashMap <>();
23532359 transactionCounters = new ConcurrentHashMap <>();
2360+ transactionToTrace = new ConcurrentHashMap <>();
23542361 partitionTokens = new ConcurrentHashMap <>();
23552362 transactionLastUsed = new ConcurrentHashMap <>();
23562363 transactionSequenceNo = new ConcurrentHashMap <>();
0 commit comments