Pavel Pereslegin created IGNITE-23792:
-----------------------------------------

             Summary: Sql. Cleanup the query cancellation handling
                 Key: IGNITE-23792
                 URL: https://issues.apache.org/jira/browse/IGNITE-23792
             Project: Ignite
          Issue Type: Improvement
          Components: sql
            Reporter: Pavel Pereslegin


h4. 1. Cleanup query timeout handling

Currently, the action to close the cursor is added to 
CursorInitializationPhaseHandler#handle. But this "action" ignores cancellation 
by timeout.
{code:java}
    query.cancel.add(timeout -> {
        if (!timeout) {
            cursor.closeAsync(true);
        }
    });
{code}

It is necessary to handle timeout similarly to handling user cancellation and 
clean up the extra code where this action is added specifically for timeout.
Instead of {{AsyncCursor.close(boolean cancelled)}} we can use 
{{AsyncCursor.close(QueryCompletionReason reason)}}, for example.

h4. 
h4. 2. Cleanup error handling in MultiStatementHandler

Currently the method {{ScriptTransactionWrapperImpl#rollback(Throwable)}} 
closes opened cursors (related to script transaction). But it should not do 
that. The logic for rolling back the script transaction is already contained in 
{{TxAwareAsyncCursor#closeAsync(boolean)}}.
The only problem that remains is the internal error handling when executing the 
script (see the places where {{ScriptTransactionContext#onError(Throwable)}} is 
called).

It is necessary to correctly complete the statement query in case of an error. 
Example of "internal error" test - {{dmlFailsOnReadOnlyTransaction}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to