This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new e7b982635e1 branch-3.0: [Fix](Job)Fix redundant job scheduling by
preventing same state transitions (e.g., RUNNING → RUNNING) #45495 (#45646)
e7b982635e1 is described below
commit e7b982635e1418d33ce755b48dbed537f014af70
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Dec 20 00:40:21 2024 +0800
branch-3.0: [Fix](Job)Fix redundant job scheduling by preventing same state
transitions (e.g., RUNNING → RUNNING) #45495 (#45646)
Cherry-picked from #45495
Co-authored-by: Calvin Kirs <[email protected]>
---
.../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: [email protected]
For additional commands, e-mail: [email protected]