This is an automated email from the ASF dual-hosted git repository. kirs pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push: new cc691b6e012 branch-2.1: [Fix](Job)Fix redundant job scheduling by preventing same state transitions (e.g., RUNNING → RUNNING) #45495 (#45647) cc691b6e012 is described below commit cc691b6e012c45bbcc32536839c1bd01aa935e64 Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Thu Dec 19 23:28:37 2024 +0800 branch-2.1: [Fix](Job)Fix redundant job scheduling by preventing same state transitions (e.g., RUNNING → RUNNING) #45495 (#45647) Cherry-picked from #45495 Co-authored-by: Calvin Kirs <guoqi...@selectdb.com> --- .../src/main/java/org/apache/doris/job/manager/JobManager.java | 6 +++++- regression-test/suites/job_p0/test_base_insert_job.groovy | 9 ++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/job/manager/JobManager.java b/fe/fe-core/src/main/java/org/apache/doris/job/manager/JobManager.java index 47a3a0c5c19..08cdb130b73 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/job/manager/JobManager.java +++ b/fe/fe-core/src/main/java/org/apache/doris/job/manager/JobManager.java @@ -199,9 +199,13 @@ public class JobManager<T extends AbstractJob<?, C>, C> implements Writable { for (T a : jobMap.values()) { if (a.getJobName().equals(jobName)) { try { + if (jobStatus.equals(a.getJobStatus())) { + throw new JobException("Can't change job status to the same status"); + } alterJobStatus(a.getJobId(), jobStatus); } catch (JobException e) { - throw new JobException("unregister job error, jobName:" + jobName); + throw new JobException("Alter job status error, jobName is %s, errorMsg is %s", + jobName, e.getMessage()); } } } diff --git a/regression-test/suites/job_p0/test_base_insert_job.groovy b/regression-test/suites/job_p0/test_base_insert_job.groovy index 33ae28443b2..1703b355c95 100644 --- a/regression-test/suites/job_p0/test_base_insert_job.groovy +++ b/regression-test/suites/job_p0/test_base_insert_job.groovy @@ -190,6 +190,11 @@ suite("test_base_insert_job") { // check job status and succeed task count is 1 pressJob.size() == 1 && '1' == onceJob.get(0).get(0) }) + assertThrows(Exception) { + sql """ + RESUME JOB where jobName='press' + """ + } sql """ DROP JOB IF EXISTS where jobname = 'past_start_time' @@ -299,12 +304,10 @@ suite("test_base_insert_job") { assert e.getMessage().contains("Invalid interval time unit: years") } // assert interval time unit is -1 - try { + assertThrows(Exception) { sql """ CREATE JOB test_error_starts ON SCHEDULE every -1 second comment 'test' DO insert into ${tableName} (timestamp, type, user_id) values ('2023-03-18','1','12213'); """ - } catch (Exception e) { - assert e.getMessage().contains("expecting INTEGER_VALUE") } // test keyword as job name --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org