Skip to content

Commit c24e15f

Browse files
IGNITE-28502 SQL Calcite: Add deadlock detection for queries initiated by UDF - Fixes #13004.
Signed-off-by: Aleksey Plekhanov <plehanov.alex@gmail.com>
1 parent f868fb9 commit c24e15f

File tree

4 files changed

+298
-254
lines changed

4 files changed

+298
-254
lines changed

modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/CalciteQueryProcessor.java

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
import org.apache.ignite.internal.processors.query.calcite.exec.TimeoutService;
8383
import org.apache.ignite.internal.processors.query.calcite.exec.TimeoutServiceImpl;
8484
import org.apache.ignite.internal.processors.query.calcite.exec.exp.RexExecutorImpl;
85-
import org.apache.ignite.internal.processors.query.calcite.exec.task.AbstractQueryTaskExecutor;
8685
import org.apache.ignite.internal.processors.query.calcite.exec.task.QueryBlockingTaskExecutor;
8786
import org.apache.ignite.internal.processors.query.calcite.exec.task.StripedQueryTaskExecutor;
8887
import org.apache.ignite.internal.processors.query.calcite.hint.HintsConfig;
@@ -272,9 +271,6 @@ public class CalciteQueryProcessor extends GridProcessorAdapter implements Query
272271
/** */
273272
private final InjectResourcesService injectSvc;
274273

275-
/** */
276-
private final AtomicBoolean udfQryWarned = new AtomicBoolean();
277-
278274
/** */
279275
private volatile boolean started;
280276

@@ -545,8 +541,6 @@ private <T> List<T> parseAndProcessQuery(
545541
) throws IgniteSQLException {
546542
ensureTransactionModeSupported(qryCtx);
547543

548-
checkUdfQuery();
549-
550544
SchemaPlus schema = schemaHolder.schema(schemaName);
551545

552546
assert schema != null : "Schema not found: " + schemaName;
@@ -704,29 +698,6 @@ private void ensureTransactionModeSupported(@Nullable QueryContext qryCtx) {
704698
IgniteTxManager.ensureTransactionModeSupported(ctx.cache().context().tm().tx(ver).isolation());
705699
}
706700

707-
/** Checks that query is initiated by UDF and print message to log if needed. */
708-
private void checkUdfQuery() {
709-
if (udfQryWarned.get())
710-
return;
711-
712-
if (Thread.currentThread().getName().startsWith(AbstractQueryTaskExecutor.THREAD_PREFIX)
713-
&& udfQryWarned.compareAndSet(false, true)) {
714-
if (taskExecutor instanceof QueryBlockingTaskExecutor) {
715-
log.info("Detected query initiated by user-defined function. " +
716-
"In some circumstances, this can lead to thread pool starvation and deadlock. Ensure that " +
717-
"the pool size is properly configured (property IgniteConfiguration.QueryThreadPoolSize). " +
718-
"The pool size should be greater than the maximum number of concurrent queries initiated by UDFs.");
719-
}
720-
else {
721-
log.warning("Detected query initiated by user-defined function. " +
722-
"When a striped query task executor (the default configuration) is used, tasks for such queries " +
723-
"can be assigned to the same thread as that held by the initial query, which can lead to a " +
724-
"deadlock. To switch to a blocking tasks executor, set the following parameter: " +
725-
"-DIGNITE_CALCITE_USE_QUERY_BLOCKING_TASK_EXECUTOR=true.");
726-
}
727-
}
728-
}
729-
730701
/** */
731702
private <T> T processQuery(
732703
@Nullable QueryContext qryCtx,

0 commit comments

Comments
 (0)