Skip to content

Commit f58bf53

Browse files
IGNITE-28502 Calcite SQL: Add deadlock detection for queries initiated by UDF
1 parent 2b10e24 commit f58bf53

4 files changed

Lines changed: 297 additions & 250 deletions

File tree

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

Lines changed: 0 additions & 26 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;
@@ -545,8 +544,6 @@ private <T> List<T> parseAndProcessQuery(
545544
) throws IgniteSQLException {
546545
ensureTransactionModeSupported(qryCtx);
547546

548-
checkUdfQuery();
549-
550547
SchemaPlus schema = schemaHolder.schema(schemaName);
551548

552549
assert schema != null : "Schema not found: " + schemaName;
@@ -704,29 +701,6 @@ private void ensureTransactionModeSupported(@Nullable QueryContext qryCtx) {
704701
IgniteTxManager.ensureTransactionModeSupported(ctx.cache().context().tm().tx(ver).isolation());
705702
}
706703

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-
730704
/** */
731705
private <T> T processQuery(
732706
@Nullable QueryContext qryCtx,

0 commit comments

Comments
 (0)