wenzhenghu commented on code in PR #68727:
URL: https://github.com/apache/doris/pull/68727#discussion_r4267304461
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/scheduler/SimpleJobScheduler.java:
##########
@@ -48,7 +49,15 @@ public void executeJobPool(ScheduleContext scheduleContext) {
}
}
Job job = pool.pop();
- job.execute();
+ PlanningDiagnostics diagnostics =
PlanningDiagnostics.current(context.getConnectContext());
Review Comment:
Hoisted `PlanningDiagnostics.current(context)` above the optimizer job loop
in
[5d0a0779ce8d](https://github.com/apache/doris/commit/5d0a0779ce8db4a5f372cff13e1e07ba0d7b530a).
The loop now only updates the current job on that captured diagnostics
instance. The scheduler's cancellation and exception paths are unchanged.
##########
fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java:
##########
@@ -1326,7 +1327,22 @@ public void cancelQuery(Status cancelReason) {
}
}
+ // Published independently of StatementContext's monitor, which is held
during table-lock acquisition.
+ private volatile PlanningDiagnostics planningDiagnostics;
+
+ public PlanningDiagnostics getPlanningDiagnostics() {
+ return planningDiagnostics;
+ }
+
+ public void setPlanningDiagnostics(PlanningDiagnostics diagnostics) {
+ planningDiagnostics = diagnostics;
+ }
+
public void checkTimeout(long now) {
+ PlanningDiagnostics diagnostics = planningDiagnostics;
+ if (diagnostics != null) {
+ diagnostics.reportIfSlow();
Review Comment:
Addressed in
[5d0a0779ce8d](https://github.com/apache/doris/commit/5d0a0779ce8db4a5f372cff13e1e07ba0d7b530a).
The existing timeout/kill logic now runs first, and `reportIfSlow()` runs
afterward in `finally`. Diagnostic formatting/logging can no longer prevent
reaching the timeout decision for that round.
The diagnostic reference is captured before handling, so cancellation can
clear the connection state without losing the diagnostic snapshot.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]