Skip to content

Commit e1dcd75

Browse files
committed
fix: Alert task error
1 parent 3da6354 commit e1dcd75

File tree

7 files changed

+18
-13
lines changed

7 files changed

+18
-13
lines changed

docs/sql/addition.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ CREATE INDEX t_job_run_job_id_idx USING BTREE ON platform.t_job_run (job_id);
1717

1818
CREATE INDEX t_job_flow_run_name_idx USING BTREE ON platform.t_job_flow_run (name);
1919
CREATE INDEX t_job_run_name_idx USING BTREE ON platform.t_job_run (name);
20+
21+
-- 2024-12-04
22+
CREATE INDEX t_job_run_stop_time_idx USING BTREE ON platform.t_job_run (stop_time);
23+
CREATE INDEX t_job_flow_run_end_time_idx USING BTREE ON platform.t_job_flow_run (end_time);
24+

flink-platform-dao/src/main/java/com/flink/platform/dao/mapper/JobRunInfoMapper.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ SELECT max(r.id) as run_id
6666
<if test="jobStatus != null">
6767
AND j.status = #{jobStatus}
6868
</if>
69-
<if test="jobRunStatusList != null and jobRunStatusList.size() > 0">
70-
AND r.status in
71-
<foreach collection="jobRunStatusList" item="jobRunStatus" open='(' close=')' separator=','>
72-
#{jobRunStatus}
73-
</foreach>
74-
</if>
7569
GROUP BY r.job_id
7670
) t2
77-
WHERE t1.id = t2.run_id;
71+
WHERE t1.id = t2.run_id
72+
<if test="jobRunStatusList != null and jobRunStatusList.size() > 0">
73+
AND t1.status in
74+
<foreach collection="jobRunStatusList" item="jobRunStatus" open='(' close=')' separator=','>
75+
#{jobRunStatus}
76+
</foreach>
77+
</if>
7878
</script>
7979
""")
8080
List<JobRunInfo> queryLastJobRuns(

flink-platform-dao/src/main/java/com/flink/platform/dao/service/WorkerService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
@DS("master_platform")
1515
public class WorkerService extends ServiceImpl<WorkerMapper, Worker> {
1616

17-
public Worker getCurrentWorker() {
17+
public Worker getCurWorkerIdAndRole() {
1818
return getOne(new QueryWrapper<Worker>()
1919
.lambda()
20-
.select(Worker::getId)
20+
.select(Worker::getId, Worker::getRole)
2121
.eq(Worker::getIp, HOST_IP)
2222
.last("LIMIT 1"));
2323
}

flink-platform-monitor/src/main/java/com/flink/platform/monitor/JobsInJobListStatusChecker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class JobsInJobListStatusChecker {
3232

3333
@Scheduled(initialDelay = 2 * 60 * 1000, fixedDelay = 10 * 60 * 1000)
3434
public void checkJobStatus() {
35-
Worker worker = workerService.getCurrentWorker();
35+
Worker worker = workerService.getCurWorkerIdAndRole();
3636
if (worker == null || !LEADER.equals(worker.getRole())) {
3737
log.info("Current worker is not leader, skip checkJobStatus.");
3838
return;

flink-platform-monitor/src/main/java/com/flink/platform/monitor/UnscheduledJobFlowChecker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class UnscheduledJobFlowChecker {
2828

2929
@Scheduled(initialDelay = 2 * 60 * 1000, fixedDelay = 60 * 60 * 1000)
3030
public void checkUnscheduledWorkflow() {
31-
Worker worker = workerService.getCurrentWorker();
31+
Worker worker = workerService.getCurWorkerIdAndRole();
3232
if (worker == null || !LEADER.equals(worker.getRole())) {
3333
log.info("Current worker is not leader, skip checkUnscheduledWorkflow.");
3434
return;

flink-platform-ui/frontend

flink-platform-web/src/main/java/com/flink/platform/web/config/WorkerHeartbeat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void initHeartbeat() {
6868

6969
public synchronized void heartbeat() {
7070
// 1. Update worker heartbeat info.
71-
Worker worker = workerService.getCurrentWorker();
71+
Worker worker = workerService.getCurWorkerIdAndRole();
7272
Long workerId = worker != null ? worker.getId() : null;
7373

7474
worker = new Worker();

0 commit comments

Comments
 (0)