diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java index c9cd1d78747bef..45b590d707a70b 100644 --- a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java +++ b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java @@ -1592,6 +1592,12 @@ public class Config extends ConfigBase { + "the value should be greater than 0, if it is <=0, default is 5."}) public static int job_mtmv_task_consumer_thread_num = 10; + /* job test config */ + /** + * If set to true, we will allow the interval unit to be set to second, when creating a recurring job. + */ + public static boolean enable_job_schedule_second_for_test = false; + /*---------------------- JOB CONFIG END------------------------*/ /** * The number of async tasks that can be queued. @See TaskDisruptor diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateJobStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateJobStmt.java index 2dee8954ac04b7..23cab5b7b55a7f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateJobStmt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateJobStmt.java @@ -19,6 +19,7 @@ import org.apache.doris.catalog.Env; import org.apache.doris.common.AnalysisException; +import org.apache.doris.common.Config; import org.apache.doris.common.ErrorCode; import org.apache.doris.common.ErrorReport; import org.apache.doris.common.UserException; @@ -138,6 +139,10 @@ public void analyze(Analyzer analyzer) throws UserException { if (null == intervalUnit) { throw new AnalysisException("invalid interval time unit " + intervalTimeUnit); } + if (intervalUnit.equals(IntervalUnit.SECOND) + && !Config.enable_job_schedule_second_for_test) { + throw new AnalysisException("interval time unit can not be week"); + } timerDefinition.setIntervalUnit(intervalUnit); } if (null != startsTimeStamp) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/job/common/IntervalUnit.java b/fe/fe-core/src/main/java/org/apache/doris/job/common/IntervalUnit.java index 26415c271d7520..dba324a81c4d86 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/job/common/IntervalUnit.java +++ b/fe/fe-core/src/main/java/org/apache/doris/job/common/IntervalUnit.java @@ -22,7 +22,7 @@ import java.util.function.Function; public enum IntervalUnit { - + SECOND("second", 0L, TimeUnit.SECONDS::toMillis), MINUTE("minute", 0L, TimeUnit.MINUTES::toMillis), HOUR("hour", 0L, TimeUnit.HOURS::toMillis), DAY("day", 0L, TimeUnit.DAYS::toMillis),