Skip to content

Commit dc64372

Browse files
committed
add task delete check
1 parent ca63ad7 commit dc64372

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ public enum Status {
286286
QUERY_TASK_PROCESS_RELATION_ERROR(50049, "query process task relation error", "查询工作流任务关系错误"),
287287
TASK_DEFINE_STATE_ONLINE(50050, "task definition {0} is already on line", "任务定义[{0}]已上线"),
288288
TASK_HAS_DOWNSTREAM(50051, "Task [{0}] exists downstream dependence", "任务[{0}]存在下游依赖"),
289+
MAIN_TABLE_USING_VERSION(50052, "the version that the master table is using", "主表正在使用该版本"),
289290
HDFS_NOT_STARTUP(60001, "hdfs not startup", "hdfs未启用"),
290291

291292
/**

dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,10 @@ public Map<String, Object> deleteByCodeAndVersion(User loginUser, long projectCo
347347
if (taskDefinition == null) {
348348
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskCode);
349349
} else {
350+
if (taskDefinition.getVersion() == version) {
351+
putMsg(result, Status.MAIN_TABLE_USING_VERSION);
352+
return result;
353+
}
350354
int delete = taskDefinitionLogMapper.deleteByCodeAndVersion(taskCode, version);
351355
if (delete > 0) {
352356
putMsg(result, Status.SUCCESS);

0 commit comments

Comments
 (0)