xtern commented on code in PR #7309:
URL: https://github.com/apache/ignite-3/pull/7309#discussion_r2655408451


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/fsm/QueryExecutionProgram.java:
##########
@@ -75,6 +80,32 @@ private QueryExecutionProgram() {
     static boolean errorHandler(Query query, Throwable th) {
         if (canRecover(query, th)) {
             query.error.set(null);
+
+            if (multiStepPlanOutdated(th)) {
+                assert query.plan instanceof MultiStepPlan;
+                assert query.currentPhase() == 
ExecutionPhase.CURSOR_INITIALIZATION : query.currentPhase();
+
+                SqlOperationContext context = query.operationContext;
+                QueryTransactionWrapper txWrapper = query.usedTransaction;
+
+                assert context != null;
+                assert txWrapper != null;
+
+                context.getAndSetTxOnRetry(txWrapper);

Review Comment:
   Thanks, fixed, but with some caveats:
   1. The context is recreated (copied) via a static method of 
`SqlOperationContext.withTransactionForRetry(tx)`, since there's currently no 
external access to, for example, `errorListener` .
   2. The method to retrieve transaction on retry 
(`SqlOperationContext.retryTx()`) has getAndSet(null) semantic to avoid issues 
with retry/recovery AFTER re-planning the query.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to