From 01032cb381cc2f2eea4f9bdbd74f22a67c30a014 Mon Sep 17 00:00:00 2001 From: Calvin Kirs Date: Fri, 6 Dec 2024 02:00:06 +0800 Subject: [PATCH] [Chore](Job)Add scheduling logs for periodic jobs. (#44843) ### What problem does this PR solve? To facilitate troubleshooting and ensure the scheduler is functioning correctly. --- .../apache/doris/job/executor/TimerJobSchedulerTask.java | 2 ++ .../java/org/apache/doris/job/scheduler/JobScheduler.java | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/job/executor/TimerJobSchedulerTask.java b/fe/fe-core/src/main/java/org/apache/doris/job/executor/TimerJobSchedulerTask.java index 65a9cf2e091164..4269fa0d8f3c52 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/job/executor/TimerJobSchedulerTask.java +++ b/fe/fe-core/src/main/java/org/apache/doris/job/executor/TimerJobSchedulerTask.java @@ -48,6 +48,8 @@ public void run(Timeout timeout) { log.warn("dispatch timer job failed, queue maybe full. job id is {}, job name is {}", this.job.getJobId(), this.job.getJobName() + getMsgWhenExecuteQueueFull()); } + log.info("dispatch timer job success, job id is {}, job name is {}", this.job.getJobId(), + this.job.getJobName()); } catch (Exception e) { log.warn("dispatch timer job error, task id is {}", this.job.getJobId(), e); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/job/scheduler/JobScheduler.java b/fe/fe-core/src/main/java/org/apache/doris/job/scheduler/JobScheduler.java index ea0c263a5ee1c3..c43376de304ec6 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/job/scheduler/JobScheduler.java +++ b/fe/fe-core/src/main/java/org/apache/doris/job/scheduler/JobScheduler.java @@ -146,6 +146,11 @@ public void close() throws IOException { private void cycleTimerJobScheduler(T job, long startTimeWindowMs) { List delaySeconds = job.getJobConfig().getTriggerDelayTimes(System.currentTimeMillis(), startTimeWindowMs, latestBatchSchedulerTimerTaskTimeMs); + if (CollectionUtils.isEmpty(delaySeconds)) { + log.info("skip job {} scheduler timer job, delay seconds is empty", job.getJobName()); + return; + } + log.info("job {} scheduler timer job, delay seconds size is {}", job.getJobName(), delaySeconds.size()); if (CollectionUtils.isNotEmpty(delaySeconds)) { delaySeconds.forEach(delaySecond -> { TimerJobSchedulerTask timerJobSchedulerTask = new TimerJobSchedulerTask<>(timerJobDisruptor, job); @@ -186,6 +191,8 @@ private void executeTimerJobIdsWithinLastTenMinutesWindow() { this.latestBatchSchedulerTimerTaskTimeMs = System.currentTimeMillis(); } this.latestBatchSchedulerTimerTaskTimeMs += BATCH_SCHEDULER_INTERVAL_MILLI_SECONDS; + log.info("execute timer job ids within last ten minutes window, last time window is {}", + TimeUtils.longToTimeString(lastTimeWindowMs)); if (jobMap.isEmpty()) { return; } @@ -207,6 +214,7 @@ private void clearEndJob(T job) { } try { Env.getCurrentEnv().getJobManager().unregisterJob(job.getJobId()); + log.info("clear finish job, job id is {}, job name is {}", job.getJobId(), job.getJobName()); } catch (JobException e) { log.error("clear finish job error, job id is {}", job.getJobId(), e); }