[
https://issues.apache.org/jira/browse/IGNITE-23792?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pavel Pereslegin updated IGNITE-23792:
--------------------------------------
Description:
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
(search for "{{scheduleTimeout(}}" and "{{queryCancel.add(timeout}}).
Instead of {{AsyncCursor.close(boolean cancelled)}} we can use
{{AsyncCursor.close(QueryCompletionReason reason)}}, for example (already done
in IGNITE-24005).
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(cancelled=true)}}.
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 terminate the child query in case of an error.
Example of "internal error" test - {{dmlFailsOnReadOnlyTransaction}}.
was:
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(cancelled=true)}}.
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 terminate the child query in case of an error.
Example of "internal error" test - {{dmlFailsOnReadOnlyTransaction}}.
> 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
> Priority: Major
> Labels: ignite-3
>
> 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
> (search for "{{scheduleTimeout(}}" and "{{queryCancel.add(timeout}}).
> Instead of {{AsyncCursor.close(boolean cancelled)}} we can use
> {{AsyncCursor.close(QueryCompletionReason reason)}}, for example (already
> done in IGNITE-24005).
> 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(cancelled=true)}}.
> 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 terminate the child query in case of an error.
> Example of "internal error" test - {{dmlFailsOnReadOnlyTransaction}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)