From 562fb6db8394312e9ac8d23791db8d8ec00c7148 Mon Sep 17 00:00:00 2001 From: mch_ucchi <41606806+sohardforaname@users.noreply.github.com> Date: Thu, 8 Dec 2022 15:55:09 +0800 Subject: [PATCH] [fix](Nereids) event channel dead loop until queue is not empty (#14816) --- .../apache/doris/nereids/metrics/EventChannel.java | 14 +------------- .../main/java/org/apache/doris/qe/VariableMgr.java | 3 ++- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/metrics/EventChannel.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/metrics/EventChannel.java index 83e844a0b1..8c998ed562 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/metrics/EventChannel.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/metrics/EventChannel.java @@ -71,10 +71,7 @@ public class EventChannel { public void run() { while (!isStop.get() || !queue.isEmpty()) { try { - Event e = queue.poll(); - if (e == null) { - continue; - } + Event e = queue.take(); for (EventConsumer consumer : consumers.get(e.getClass())) { if (enhancers.containsKey(e.getClass())) { enhancers.get(e.getClass()).enhance(e); @@ -115,14 +112,5 @@ public class EventChannel { */ public void stop() { isStop.set(true); - if (thread != null) { - try { - thread.join(); - } catch (InterruptedException e) { - LOG.warn("join worker failed.", e); - } finally { - thread = null; - } - } } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java index 214f983c8b..090af9f695 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java @@ -144,7 +144,7 @@ public class VariableMgr { if (!attr.checker().equals("")) { Preconditions.checkArgument(obj instanceof SessionVariable); try { - SessionVariable.class.getDeclaredMethod(attr.checker()).invoke(obj); + SessionVariable.class.getDeclaredMethod(attr.checker(), String.class).invoke(obj, value); } catch (Exception e) { ErrorReport.reportDdlException(ErrorCode.ERR_INVALID_VALUE, attr.name(), value, e.getMessage()); } @@ -527,6 +527,7 @@ public class VariableMgr { // the function name that check the VarAttr before setting it to sessionVariable // only support check function: 0 argument and 0 return value, if an error occurs, throw an exception. + // the checker function should be: public void checker(String value), value is the input string. String checker() default ""; // Set to true if the variables need to be forwarded along with forward statement.