From 5fead427f227bd6261b677fff600e4f913462c5e Mon Sep 17 00:00:00 2001 From: Hua Jiang Date: Thu, 16 Sep 2021 15:07:22 +0800 Subject: [PATCH] [Bug-6152][Server] Fix the the exception of manual workflow execution (#6209) --- .../mapper/ProcessTaskRelationLogMapper.xml | 4 +- .../dao/mapper/ProcessTaskRelationMapper.xml | 4 +- .../dao/mapper/TaskDefinitionLogMapper.xml | 8 +- .../dao/mapper/TaskDefinitionMapper.xml | 12 +- pom.xml | 2 +- sql/dolphinscheduler_postgre.sql | 171 ++++++++++-------- 6 files changed, 113 insertions(+), 88 deletions(-) diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationLogMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationLogMapper.xml index c2884c420b..3e11f97408 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationLogMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationLogMapper.xml @@ -19,7 +19,7 @@ - id, `name`, process_definition_version, project_code, process_definition_code, pre_task_code, pre_task_version, + id, name, process_definition_version, project_code, process_definition_code, pre_task_code, pre_task_version, post_task_code, post_task_version, condition_type, condition_params, operator, operate_time, create_time, update_time - insert into t_ds_process_task_relation_log (`name`, process_definition_version, project_code, process_definition_code, + insert into t_ds_process_task_relation_log (name, process_definition_version, project_code, process_definition_code, pre_task_code, pre_task_version, post_task_code, post_task_version, condition_type, condition_params, operator, operate_time, create_time, update_time) values diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationMapper.xml index 73e67f5a64..83c3b5b261 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationMapper.xml @@ -19,7 +19,7 @@ - id, `name`, process_definition_version, project_code, process_definition_code, pre_task_code, pre_task_version, + id, name, process_definition_version, project_code, process_definition_code, pre_task_code, pre_task_version, post_task_code, post_task_version, condition_type, condition_params, create_time, update_time - insert into t_ds_task_definition_log (code, `name`, version, description, project_code, user_id, - task_type, task_params, flag, task_priority, worker_group, fail_retry_times, fail_retry_interval, + insert into t_ds_task_definition_log (code, name, version, description, project_code, user_id, + task_type, task_params, flag, task_priority, worker_group, environment_code, fail_retry_times, fail_retry_interval, timeout_flag, timeout_notify_strategy, timeout, delay_time, resource_ids, operator, operate_time, create_time, update_time) values (#{taskDefinitionLog.code},#{taskDefinitionLog.name},#{taskDefinitionLog.version},#{taskDefinitionLog.description}, #{taskDefinitionLog.projectCode},#{taskDefinitionLog.userId},#{taskDefinitionLog.taskType},#{taskDefinitionLog.taskParams}, - #{taskDefinitionLog.flag},#{taskDefinitionLog.taskPriority},#{taskDefinitionLog.workerGroup},#{taskDefinitionLog.failRetryTimes}, + #{taskDefinitionLog.flag},#{taskDefinitionLog.taskPriority},#{taskDefinitionLog.workerGroup},#{taskDefinitionLog.environmentCode},#{taskDefinitionLog.failRetryTimes}, #{taskDefinitionLog.failRetryInterval},#{taskDefinitionLog.timeoutFlag},#{taskDefinitionLog.timeoutNotifyStrategy},#{taskDefinitionLog.timeout}, #{taskDefinitionLog.delayTime},#{taskDefinitionLog.resourceIds},#{taskDefinitionLog.operator},#{taskDefinitionLog.operateTime}, #{taskDefinitionLog.createTime},#{taskDefinitionLog.updateTime}) diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapper.xml index c9d4b1a2ee..0cb11f81a3 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapper.xml @@ -19,7 +19,7 @@ - id, code, `name`, version, description, project_code, user_id, task_type, task_params, flag, task_priority, + id, code, name, version, description, project_code, user_id, task_type, task_params, flag, task_priority, worker_group, environment_code, fail_retry_times, fail_retry_interval, timeout_flag, timeout_notify_strategy, timeout, delay_time, resource_ids, create_time, update_time @@ -28,7 +28,7 @@ from t_ds_task_definition WHERE project_code = #{projectCode} - and `name` = #{name} + and name = #{name} select td.id, td.code, td.name, td.version, td.description, td.project_code, td.user_id, td.task_type, td.task_params, - td.flag, td.task_priority, td.worker_group, td.fail_retry_times, td.fail_retry_interval, td.timeout_flag, td.timeout_notify_strategy, + td.flag, td.task_priority, td.worker_group,td.environment_code, td.fail_retry_times, td.fail_retry_interval, td.timeout_flag, td.timeout_notify_strategy, td.timeout, td.delay_time, td.resource_ids, td.create_time, td.update_time, u.user_name,p.name as project_name from t_ds_task_definition td JOIN t_ds_user u ON td.user_id = u.id diff --git a/pom.xml b/pom.xml index 1d6c51f666..8c59446ebe 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,7 @@ ~ limitations under the License. --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.apache.dolphinscheduler dolphinscheduler diff --git a/sql/dolphinscheduler_postgre.sql b/sql/dolphinscheduler_postgre.sql index f1ac87709e..1c6694c1b4 100644 --- a/sql/dolphinscheduler_postgre.sql +++ b/sql/dolphinscheduler_postgre.sql @@ -27,57 +27,64 @@ DROP TABLE IF EXISTS QRTZ_TRIGGERS; DROP TABLE IF EXISTS QRTZ_JOB_DETAILS; DROP TABLE IF EXISTS QRTZ_CALENDARS; -CREATE TABLE QRTZ_JOB_DETAILS( -SCHED_NAME character varying(120) NOT NULL, -JOB_NAME character varying(200) NOT NULL, -JOB_GROUP character varying(200) NOT NULL, -DESCRIPTION character varying(250) NULL, -JOB_CLASS_NAME character varying(250) NOT NULL, -IS_DURABLE boolean NOT NULL, -IS_NONCONCURRENT boolean NOT NULL, -IS_UPDATE_DATA boolean NOT NULL, -REQUESTS_RECOVERY boolean NOT NULL, -JOB_DATA bytea NULL); +CREATE TABLE QRTZ_JOB_DETAILS ( + SCHED_NAME character varying(120) NOT NULL, + JOB_NAME character varying(200) NOT NULL, + JOB_GROUP character varying(200) NOT NULL, + DESCRIPTION character varying(250) NULL, + JOB_CLASS_NAME character varying(250) NOT NULL, + IS_DURABLE boolean NOT NULL, + IS_NONCONCURRENT boolean NOT NULL, + IS_UPDATE_DATA boolean NOT NULL, + REQUESTS_RECOVERY boolean NOT NULL, + JOB_DATA bytea NULL +); + alter table QRTZ_JOB_DETAILS add primary key(SCHED_NAME,JOB_NAME,JOB_GROUP); CREATE TABLE QRTZ_TRIGGERS ( -SCHED_NAME character varying(120) NOT NULL, -TRIGGER_NAME character varying(200) NOT NULL, -TRIGGER_GROUP character varying(200) NOT NULL, -JOB_NAME character varying(200) NOT NULL, -JOB_GROUP character varying(200) NOT NULL, -DESCRIPTION character varying(250) NULL, -NEXT_FIRE_TIME BIGINT NULL, -PREV_FIRE_TIME BIGINT NULL, -PRIORITY INTEGER NULL, -TRIGGER_STATE character varying(16) NOT NULL, -TRIGGER_TYPE character varying(8) NOT NULL, -START_TIME BIGINT NOT NULL, -END_TIME BIGINT NULL, -CALENDAR_NAME character varying(200) NULL, -MISFIRE_INSTR SMALLINT NULL, -JOB_DATA bytea NULL) ; + SCHED_NAME character varying(120) NOT NULL, + TRIGGER_NAME character varying(200) NOT NULL, + TRIGGER_GROUP character varying(200) NOT NULL, + JOB_NAME character varying(200) NOT NULL, + JOB_GROUP character varying(200) NOT NULL, + DESCRIPTION character varying(250) NULL, + NEXT_FIRE_TIME BIGINT NULL, + PREV_FIRE_TIME BIGINT NULL, + PRIORITY INTEGER NULL, + TRIGGER_STATE character varying(16) NOT NULL, + TRIGGER_TYPE character varying(8) NOT NULL, + START_TIME BIGINT NOT NULL, + END_TIME BIGINT NULL, + CALENDAR_NAME character varying(200) NULL, + MISFIRE_INSTR SMALLINT NULL, + JOB_DATA bytea NULL +) ; + alter table QRTZ_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); CREATE TABLE QRTZ_SIMPLE_TRIGGERS ( -SCHED_NAME character varying(120) NOT NULL, -TRIGGER_NAME character varying(200) NOT NULL, -TRIGGER_GROUP character varying(200) NOT NULL, -REPEAT_COUNT BIGINT NOT NULL, -REPEAT_INTERVAL BIGINT NOT NULL, -TIMES_TRIGGERED BIGINT NOT NULL) ; + SCHED_NAME character varying(120) NOT NULL, + TRIGGER_NAME character varying(200) NOT NULL, + TRIGGER_GROUP character varying(200) NOT NULL, + REPEAT_COUNT BIGINT NOT NULL, + REPEAT_INTERVAL BIGINT NOT NULL, + TIMES_TRIGGERED BIGINT NOT NULL +) ; + alter table QRTZ_SIMPLE_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); CREATE TABLE QRTZ_CRON_TRIGGERS ( -SCHED_NAME character varying(120) NOT NULL, -TRIGGER_NAME character varying(200) NOT NULL, -TRIGGER_GROUP character varying(200) NOT NULL, -CRON_EXPRESSION character varying(120) NOT NULL, -TIME_ZONE_ID character varying(80)) ; + SCHED_NAME character varying(120) NOT NULL, + TRIGGER_NAME character varying(200) NOT NULL, + TRIGGER_GROUP character varying(200) NOT NULL, + CRON_EXPRESSION character varying(120) NOT NULL, + TIME_ZONE_ID character varying(80) +) ; + alter table QRTZ_CRON_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); -CREATE TABLE QRTZ_SIMPROP_TRIGGERS - ( +CREATE TABLE QRTZ_SIMPROP_TRIGGERS ( SCHED_NAME character varying(120) NOT NULL, TRIGGER_NAME character varying(200) NOT NULL, TRIGGER_GROUP character varying(200) NOT NULL, @@ -91,53 +98,67 @@ CREATE TABLE QRTZ_SIMPROP_TRIGGERS DEC_PROP_1 NUMERIC(13,4) NULL, DEC_PROP_2 NUMERIC(13,4) NULL, BOOL_PROP_1 boolean NULL, - BOOL_PROP_2 boolean NULL) ; + BOOL_PROP_2 boolean NULL +) ; + alter table QRTZ_SIMPROP_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); CREATE TABLE QRTZ_BLOB_TRIGGERS ( -SCHED_NAME character varying(120) NOT NULL, -TRIGGER_NAME character varying(200) NOT NULL, -TRIGGER_GROUP character varying(200) NOT NULL, -BLOB_DATA bytea NULL) ; + SCHED_NAME character varying(120) NOT NULL, + TRIGGER_NAME character varying(200) NOT NULL, + TRIGGER_GROUP character varying(200) NOT NULL, + BLOB_DATA bytea NULL +) ; + alter table QRTZ_BLOB_TRIGGERS add primary key(SCHED_NAME,TRIGGER_NAME,TRIGGER_GROUP); CREATE TABLE QRTZ_CALENDARS ( -SCHED_NAME character varying(120) NOT NULL, -CALENDAR_NAME character varying(200) NOT NULL, -CALENDAR bytea NOT NULL) ; + SCHED_NAME character varying(120) NOT NULL, + CALENDAR_NAME character varying(200) NOT NULL, + CALENDAR bytea NOT NULL +) ; + alter table QRTZ_CALENDARS add primary key(SCHED_NAME,CALENDAR_NAME); CREATE TABLE QRTZ_PAUSED_TRIGGER_GRPS ( -SCHED_NAME character varying(120) NOT NULL, -TRIGGER_GROUP character varying(200) NOT NULL) ; + SCHED_NAME character varying(120) NOT NULL, + TRIGGER_GROUP character varying(200) NOT NULL +) ; + alter table QRTZ_PAUSED_TRIGGER_GRPS add primary key(SCHED_NAME,TRIGGER_GROUP); CREATE TABLE QRTZ_FIRED_TRIGGERS ( -SCHED_NAME character varying(120) NOT NULL, -ENTRY_ID character varying(200) NOT NULL, -TRIGGER_NAME character varying(200) NOT NULL, -TRIGGER_GROUP character varying(200) NOT NULL, -INSTANCE_NAME character varying(200) NOT NULL, -FIRED_TIME BIGINT NOT NULL, -SCHED_TIME BIGINT NOT NULL, -PRIORITY INTEGER NOT NULL, -STATE character varying(16) NOT NULL, -JOB_NAME character varying(200) NULL, -JOB_GROUP character varying(200) NULL, -IS_NONCONCURRENT boolean NULL, -REQUESTS_RECOVERY boolean NULL) ; + SCHED_NAME character varying(120) NOT NULL, + ENTRY_ID character varying(200) NOT NULL, + TRIGGER_NAME character varying(200) NOT NULL, + TRIGGER_GROUP character varying(200) NOT NULL, + INSTANCE_NAME character varying(200) NOT NULL, + FIRED_TIME BIGINT NOT NULL, + SCHED_TIME BIGINT NOT NULL, + PRIORITY INTEGER NOT NULL, + STATE character varying(16) NOT NULL, + JOB_NAME character varying(200) NULL, + JOB_GROUP character varying(200) NULL, + IS_NONCONCURRENT boolean NULL, + REQUESTS_RECOVERY boolean NULL +) ; + alter table QRTZ_FIRED_TRIGGERS add primary key(SCHED_NAME,ENTRY_ID); CREATE TABLE QRTZ_SCHEDULER_STATE ( -SCHED_NAME character varying(120) NOT NULL, -INSTANCE_NAME character varying(200) NOT NULL, -LAST_CHECKIN_TIME BIGINT NOT NULL, -CHECKIN_INTERVAL BIGINT NOT NULL) ; + SCHED_NAME character varying(120) NOT NULL, + INSTANCE_NAME character varying(200) NOT NULL, + LAST_CHECKIN_TIME BIGINT NOT NULL, + CHECKIN_INTERVAL BIGINT NOT NULL +) ; + alter table QRTZ_SCHEDULER_STATE add primary key(SCHED_NAME,INSTANCE_NAME); CREATE TABLE QRTZ_LOCKS ( -SCHED_NAME character varying(120) NOT NULL, -LOCK_NAME character varying(40) NOT NULL) ; + SCHED_NAME character varying(120) NOT NULL, + LOCK_NAME character varying(40) NOT NULL +) ; + alter table QRTZ_LOCKS add primary key(SCHED_NAME,LOCK_NAME); CREATE INDEX IDX_QRTZ_J_REQ_RECOVERY ON QRTZ_JOB_DETAILS(SCHED_NAME,REQUESTS_RECOVERY); @@ -471,8 +492,9 @@ CREATE TABLE t_ds_process_instance ( var_pool text , PRIMARY KEY (id) ) ; - create index process_instance_index on t_ds_process_instance (process_definition_code,id); - create index start_time_index on t_ds_process_instance (start_time); + +create index process_instance_index on t_ds_process_instance (process_definition_code,id); +create index start_time_index on t_ds_process_instance (start_time); -- -- Table structure for table t_ds_project @@ -490,7 +512,8 @@ CREATE TABLE t_ds_project ( update_time timestamp DEFAULT CURRENT_TIMESTAMP , PRIMARY KEY (id) ) ; - create index user_id_index on t_ds_project (user_id); + +create index user_id_index on t_ds_project (user_id); -- -- Table structure for table t_ds_queue @@ -613,7 +636,7 @@ CREATE TABLE t_ds_resources ( DROP TABLE IF EXISTS t_ds_schedules; CREATE TABLE t_ds_schedules ( - id int NOT NULL , + id int NOT NULL , process_definition_code bigint NOT NULL , start_time timestamp NOT NULL , end_time timestamp NOT NULL , @@ -822,9 +845,11 @@ ALTER TABLE t_ds_process_task_relation_log ALTER COLUMN id SET DEFAULT NEXTVAL(' DROP SEQUENCE IF EXISTS t_ds_process_instance_id_sequence; CREATE SEQUENCE t_ds_process_instance_id_sequence; ALTER TABLE t_ds_process_instance ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_process_instance_id_sequence'); + DROP SEQUENCE IF EXISTS t_ds_project_id_sequence; CREATE SEQUENCE t_ds_project_id_sequence; ALTER TABLE t_ds_project ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_project_id_sequence'); + DROP SEQUENCE IF EXISTS t_ds_queue_id_sequence; CREATE SEQUENCE t_ds_queue_id_sequence; ALTER TABLE t_ds_queue ALTER COLUMN id SET DEFAULT NEXTVAL('t_ds_queue_id_sequence');