Skip to content

Commit

Permalink
[Chore](Job)It is forbidden to change the status of internal JOB thro…
Browse files Browse the repository at this point in the history
…ugh PAUSE/RESUME
  • Loading branch information
CalvinKirs committed Dec 26, 2023
1 parent 92660bb commit 61affbf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public void analyze(Analyzer analyzer) throws UserException {
throw new AnalysisException("Value can't is null");
}
this.jobName = inputValue;

if (CreateJobStmt.isInnerJob(jobName)) {
throw new AnalysisException("Can't alter inner job status");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class CreateJobStmt extends DdlStmt {
private JobExecuteType executeType;

// exclude job name prefix, which is used by inner job
private final String excludeJobNamePrefix = "inner_";
private static final String excludeJobNamePrefix = "inner_";

private static final ImmutableSet<Class<? extends DdlStmt>> supportStmtSuperClass
= new ImmutableSet.Builder<Class<? extends DdlStmt>>().add(InsertStmt.class)
Expand Down Expand Up @@ -208,4 +208,8 @@ private String parseExecuteSql(String sql) throws AnalysisException {
}
return executeSql;
}

protected static boolean isInnerJob(String jobName) {
return jobName.startsWith(excludeJobNamePrefix);
}
}

0 comments on commit 61affbf

Please sign in to comment.