zddr commented on code in PR #45446:
URL: https://github.com/apache/doris/pull/45446#discussion_r1886126541


##########
fe/fe-core/src/main/java/org/apache/doris/job/base/AbstractJob.java:
##########
@@ -461,4 +467,29 @@ public void onReplayCreate() throws JobException {
     public void onReplayEnd(AbstractJob<?, C> replayJob) throws JobException {
         log.info(new LogBuilder(LogKey.SCHEDULER_JOB, getJobId()).add("msg", 
"replay delete scheduler job").build());
     }
+
+    public void updateTaskStatusAfterRestart() {
+        List<T> tasks = queryAllTasks();
+        if (CollectionUtils.isEmpty(tasks)) {
+            return;
+        }
+        List<T> runningTasks = tasks.stream().filter(task -> 
task.getStatus().equals(TaskStatus.RUNNING)

Review Comment:
   The name is runningTask, which actually includes running and pending. Would 
you consider changing the name?



##########
fe/fe-core/src/main/java/org/apache/doris/job/task/AbstractTask.java:
##########
@@ -64,26 +64,22 @@ private static long getNextTaskId() {
 
     @Override
     public void onFail() throws JobException {
-        status = TaskStatus.FAILED;
-        if (!isCallable()) {
-            return;
+        try {
+            status = TaskStatus.FAILED;
+            if (!isCallable()) {
+                return;
+            }
+            setFinishTimeMs(System.currentTimeMillis());
+            Env.getCurrentEnv().getJobManager().getJob(jobId).onTaskFail(this);
+        } finally {
+            closeOrReleaseResources();

Review Comment:
   Did you call `closeOrReleaseResources` when `onSuccess`



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to