(session) fix NereidsTracer shouldLog always true after set enable_nereids_trace from true to false (#27420)

Signed-off-by: nextdreamblue <zxw520blue1@163.com>
This commit is contained in:
xueweizhang
2023-11-28 10:22:46 +08:00
committed by GitHub
parent 65126459bd
commit c83e3318a8
2 changed files with 6 additions and 0 deletions

View File

@ -98,6 +98,8 @@ public class NereidsPlanner extends Planner {
public void plan(StatementBase queryStmt, org.apache.doris.thrift.TQueryOptions queryOptions) {
if (statementContext.getConnectContext().getSessionVariable().isEnableNereidsTrace()) {
NereidsTracer.init();
} else {
NereidsTracer.disable();
}
if (!(queryStmt instanceof LogicalPlanAdapter)) {
throw new RuntimeException("Wrong type of queryStmt, expected: <? extends LogicalPlanAdapter>");

View File

@ -176,5 +176,9 @@ public class NereidsTracer {
TRACE_PATH = Optional.ofNullable(TRACE_PATH).orElse(Config.nereids_trace_log_dir);
new File(TRACE_PATH).mkdirs();
}
public static void disable() {
NereidsTracer.shouldLog = false;
}
}