From 8b9f114550cf1b06d04005036aefc8f4f25e8224 Mon Sep 17 00:00:00 2001 From: Yeleights Date: Wed, 11 Mar 2020 21:20:04 +0800 Subject: [PATCH 1/3] fix bug: data to long for app_link field --- docker/postgres/docker-entrypoint-initdb/init.sql | 2 +- sql/create/release-1.0.0_schema/mysql/dolphinscheduler_ddl.sql | 2 +- .../release-1.2.0_schema/postgresql/dolphinscheduler_ddl.sql | 2 +- sql/dolphinscheduler-postgre.sql | 2 +- sql/dolphinscheduler_mysql.sql | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docker/postgres/docker-entrypoint-initdb/init.sql b/docker/postgres/docker-entrypoint-initdb/init.sql index b3c61ebce4dc..582087698459 100755 --- a/docker/postgres/docker-entrypoint-initdb/init.sql +++ b/docker/postgres/docker-entrypoint-initdb/init.sql @@ -567,7 +567,7 @@ CREATE TABLE t_ds_task_instance ( alert_flag int DEFAULT NULL , retry_times int DEFAULT '0' , pid int DEFAULT NULL , - app_link varchar(255) DEFAULT NULL , + app_link varchar(5999) DEFAULT NULL , flag int DEFAULT '1' , retry_interval int DEFAULT NULL , max_retry_times int DEFAULT NULL , diff --git a/sql/create/release-1.0.0_schema/mysql/dolphinscheduler_ddl.sql b/sql/create/release-1.0.0_schema/mysql/dolphinscheduler_ddl.sql index dad81b1c955e..57e45b0e2971 100644 --- a/sql/create/release-1.0.0_schema/mysql/dolphinscheduler_ddl.sql +++ b/sql/create/release-1.0.0_schema/mysql/dolphinscheduler_ddl.sql @@ -363,7 +363,7 @@ CREATE TABLE `t_escheduler_task_instance` ( `alert_flag` tinyint(4) DEFAULT NULL COMMENT 'whether alert', `retry_times` int(4) DEFAULT '0' COMMENT 'task retry times', `pid` int(4) DEFAULT NULL COMMENT 'pid of task', - `app_link` varchar(255) DEFAULT NULL COMMENT 'yarn app id', + `app_link` varchar(5999) DEFAULT NULL COMMENT 'yarn app id', `flag` tinyint(4) DEFAULT '1' COMMENT '0 not available, 1 available', `retry_interval` int(4) DEFAULT NULL COMMENT 'retry interval when task failed ', `max_retry_times` int(2) DEFAULT NULL COMMENT 'max retry times', diff --git a/sql/create/release-1.2.0_schema/postgresql/dolphinscheduler_ddl.sql b/sql/create/release-1.2.0_schema/postgresql/dolphinscheduler_ddl.sql index 75a5d56e7715..fe2f5ddd481d 100644 --- a/sql/create/release-1.2.0_schema/postgresql/dolphinscheduler_ddl.sql +++ b/sql/create/release-1.2.0_schema/postgresql/dolphinscheduler_ddl.sql @@ -567,7 +567,7 @@ CREATE TABLE t_ds_task_instance ( alert_flag int DEFAULT NULL , retry_times int DEFAULT '0' , pid int DEFAULT NULL , - app_link varchar(255) DEFAULT NULL , + app_link varchar(5999) DEFAULT NULL , flag int DEFAULT '1' , retry_interval int DEFAULT NULL , max_retry_times int DEFAULT NULL , diff --git a/sql/dolphinscheduler-postgre.sql b/sql/dolphinscheduler-postgre.sql index 88d62737deeb..582b59b356b9 100644 --- a/sql/dolphinscheduler-postgre.sql +++ b/sql/dolphinscheduler-postgre.sql @@ -568,7 +568,7 @@ CREATE TABLE t_ds_task_instance ( alert_flag int DEFAULT NULL , retry_times int DEFAULT '0' , pid int DEFAULT NULL , - app_link varchar(255) DEFAULT NULL , + app_link varchar(5999) DEFAULT NULL , flag int DEFAULT '1' , retry_interval int DEFAULT NULL , max_retry_times int DEFAULT NULL , diff --git a/sql/dolphinscheduler_mysql.sql b/sql/dolphinscheduler_mysql.sql index 68393702fc53..808ff2db764d 100644 --- a/sql/dolphinscheduler_mysql.sql +++ b/sql/dolphinscheduler_mysql.sql @@ -610,7 +610,7 @@ CREATE TABLE `t_ds_task_instance` ( `alert_flag` tinyint(4) DEFAULT NULL COMMENT 'whether alert', `retry_times` int(4) DEFAULT '0' COMMENT 'task retry times', `pid` int(4) DEFAULT NULL COMMENT 'pid of task', - `app_link` varchar(255) DEFAULT NULL COMMENT 'yarn app id', + `app_link` varchar(5999) DEFAULT NULL COMMENT 'yarn app id', `flag` tinyint(4) DEFAULT '1' COMMENT '0 not available, 1 available', `retry_interval` int(4) DEFAULT NULL COMMENT 'retry interval when task failed ', `max_retry_times` int(2) DEFAULT NULL COMMENT 'max retry times', From 0d7db532b4b70c209ba19cd06626d2591f3dd6d4 Mon Sep 17 00:00:00 2001 From: Yeleights Date: Wed, 11 Mar 2020 21:45:50 +0800 Subject: [PATCH 2/3] change app_link field length in 1.2.2 ddl --- .../mysql/dolphinscheduler_ddl.sql | 22 ++++++++++++++++++- .../postgresql/dolphinscheduler_ddl.sql | 18 +++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/sql/upgrade/1.2.2_schema/mysql/dolphinscheduler_ddl.sql b/sql/upgrade/1.2.2_schema/mysql/dolphinscheduler_ddl.sql index e5785d999775..cd3ffaf0283a 100644 --- a/sql/upgrade/1.2.2_schema/mysql/dolphinscheduler_ddl.sql +++ b/sql/upgrade/1.2.2_schema/mysql/dolphinscheduler_ddl.sql @@ -54,4 +54,24 @@ d// delimiter ; CALL uc_dolphin_T_t_ds_task_instance_A_executor_id; -DROP PROCEDURE uc_dolphin_T_t_ds_task_instance_A_executor_id; \ No newline at end of file +DROP PROCEDURE uc_dolphin_T_t_ds_task_instance_A_executor_id; + +-- uc_dolphin_T_t_ds_task_instance_C_app_link +drop PROCEDURE if EXISTS uc_dolphin_T_t_ds_task_instance_C_app_link; +delimiter d// +CREATE PROCEDURE uc_dolphin_T_t_ds_task_instance_C_app_link() + BEGIN + IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS + WHERE TABLE_NAME='t_ds_task_instance' + AND TABLE_SCHEMA=(SELECT DATABASE()) + AND COLUMN_NAME ='app_link') + THEN + alter table t_ds_task_instance modify column app_link varchar(5999); + END IF; + END; + +d// + +delimiter ; +CALL uc_dolphin_T_t_ds_task_instance_C_app_link; +DROP PROCEDURE uc_dolphin_T_t_ds_task_instance_C_app_link; \ No newline at end of file diff --git a/sql/upgrade/1.2.2_schema/postgresql/dolphinscheduler_ddl.sql b/sql/upgrade/1.2.2_schema/postgresql/dolphinscheduler_ddl.sql index 70471cb26da2..d3201598c85b 100644 --- a/sql/upgrade/1.2.2_schema/postgresql/dolphinscheduler_ddl.sql +++ b/sql/upgrade/1.2.2_schema/postgresql/dolphinscheduler_ddl.sql @@ -49,3 +49,21 @@ d// delimiter ; SELECT uc_dolphin_T_t_ds_task_instance_A_executor_id(); DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_task_instance_A_executor_id(); + +-- uc_dolphin_T_t_ds_task_instance_C_app_link +delimiter d// +CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_task_instance_C_app_link() RETURNS void AS $$ +BEGIN + IF NOT EXISTS (SELECT 1 FROM information_schema.COLUMNS + WHERE TABLE_NAME='t_ds_task_instance' + AND COLUMN_NAME ='app_link') + THEN + ALTER TABLE t_ds_task_instance ALTER COLUMN app_link character varying(5999); + END IF; +END; +$$ LANGUAGE plpgsql; +d// + +delimiter ; +SELECT uc_dolphin_T_t_ds_task_instance_C_app_link(); +DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_task_instance_C_app_link(); From fb43d178c301a38db75cc83b67bce5f8693cb3ec Mon Sep 17 00:00:00 2001 From: Yeleights Date: Wed, 11 Mar 2020 23:42:30 +0800 Subject: [PATCH 3/3] change app_link field type to text --- docker/postgres/docker-entrypoint-initdb/init.sql | 2 +- .../release-1.0.0_schema/mysql/dolphinscheduler_ddl.sql | 2 +- .../release-1.2.0_schema/postgresql/dolphinscheduler_ddl.sql | 2 +- sql/dolphinscheduler-postgre.sql | 2 +- sql/dolphinscheduler_mysql.sql | 2 +- sql/upgrade/1.2.2_schema/mysql/dolphinscheduler_ddl.sql | 2 +- sql/upgrade/1.2.2_schema/postgresql/dolphinscheduler_ddl.sql | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docker/postgres/docker-entrypoint-initdb/init.sql b/docker/postgres/docker-entrypoint-initdb/init.sql index 582087698459..b3c61ebce4dc 100755 --- a/docker/postgres/docker-entrypoint-initdb/init.sql +++ b/docker/postgres/docker-entrypoint-initdb/init.sql @@ -567,7 +567,7 @@ CREATE TABLE t_ds_task_instance ( alert_flag int DEFAULT NULL , retry_times int DEFAULT '0' , pid int DEFAULT NULL , - app_link varchar(5999) DEFAULT NULL , + app_link varchar(255) DEFAULT NULL , flag int DEFAULT '1' , retry_interval int DEFAULT NULL , max_retry_times int DEFAULT NULL , diff --git a/sql/create/release-1.0.0_schema/mysql/dolphinscheduler_ddl.sql b/sql/create/release-1.0.0_schema/mysql/dolphinscheduler_ddl.sql index 57e45b0e2971..dad81b1c955e 100644 --- a/sql/create/release-1.0.0_schema/mysql/dolphinscheduler_ddl.sql +++ b/sql/create/release-1.0.0_schema/mysql/dolphinscheduler_ddl.sql @@ -363,7 +363,7 @@ CREATE TABLE `t_escheduler_task_instance` ( `alert_flag` tinyint(4) DEFAULT NULL COMMENT 'whether alert', `retry_times` int(4) DEFAULT '0' COMMENT 'task retry times', `pid` int(4) DEFAULT NULL COMMENT 'pid of task', - `app_link` varchar(5999) DEFAULT NULL COMMENT 'yarn app id', + `app_link` varchar(255) DEFAULT NULL COMMENT 'yarn app id', `flag` tinyint(4) DEFAULT '1' COMMENT '0 not available, 1 available', `retry_interval` int(4) DEFAULT NULL COMMENT 'retry interval when task failed ', `max_retry_times` int(2) DEFAULT NULL COMMENT 'max retry times', diff --git a/sql/create/release-1.2.0_schema/postgresql/dolphinscheduler_ddl.sql b/sql/create/release-1.2.0_schema/postgresql/dolphinscheduler_ddl.sql index fe2f5ddd481d..75a5d56e7715 100644 --- a/sql/create/release-1.2.0_schema/postgresql/dolphinscheduler_ddl.sql +++ b/sql/create/release-1.2.0_schema/postgresql/dolphinscheduler_ddl.sql @@ -567,7 +567,7 @@ CREATE TABLE t_ds_task_instance ( alert_flag int DEFAULT NULL , retry_times int DEFAULT '0' , pid int DEFAULT NULL , - app_link varchar(5999) DEFAULT NULL , + app_link varchar(255) DEFAULT NULL , flag int DEFAULT '1' , retry_interval int DEFAULT NULL , max_retry_times int DEFAULT NULL , diff --git a/sql/dolphinscheduler-postgre.sql b/sql/dolphinscheduler-postgre.sql index 582b59b356b9..88d62737deeb 100644 --- a/sql/dolphinscheduler-postgre.sql +++ b/sql/dolphinscheduler-postgre.sql @@ -568,7 +568,7 @@ CREATE TABLE t_ds_task_instance ( alert_flag int DEFAULT NULL , retry_times int DEFAULT '0' , pid int DEFAULT NULL , - app_link varchar(5999) DEFAULT NULL , + app_link varchar(255) DEFAULT NULL , flag int DEFAULT '1' , retry_interval int DEFAULT NULL , max_retry_times int DEFAULT NULL , diff --git a/sql/dolphinscheduler_mysql.sql b/sql/dolphinscheduler_mysql.sql index 808ff2db764d..68393702fc53 100644 --- a/sql/dolphinscheduler_mysql.sql +++ b/sql/dolphinscheduler_mysql.sql @@ -610,7 +610,7 @@ CREATE TABLE `t_ds_task_instance` ( `alert_flag` tinyint(4) DEFAULT NULL COMMENT 'whether alert', `retry_times` int(4) DEFAULT '0' COMMENT 'task retry times', `pid` int(4) DEFAULT NULL COMMENT 'pid of task', - `app_link` varchar(5999) DEFAULT NULL COMMENT 'yarn app id', + `app_link` varchar(255) DEFAULT NULL COMMENT 'yarn app id', `flag` tinyint(4) DEFAULT '1' COMMENT '0 not available, 1 available', `retry_interval` int(4) DEFAULT NULL COMMENT 'retry interval when task failed ', `max_retry_times` int(2) DEFAULT NULL COMMENT 'max retry times', diff --git a/sql/upgrade/1.2.2_schema/mysql/dolphinscheduler_ddl.sql b/sql/upgrade/1.2.2_schema/mysql/dolphinscheduler_ddl.sql index cd3ffaf0283a..049484ce3a9a 100644 --- a/sql/upgrade/1.2.2_schema/mysql/dolphinscheduler_ddl.sql +++ b/sql/upgrade/1.2.2_schema/mysql/dolphinscheduler_ddl.sql @@ -66,7 +66,7 @@ CREATE PROCEDURE uc_dolphin_T_t_ds_task_instance_C_app_link() AND TABLE_SCHEMA=(SELECT DATABASE()) AND COLUMN_NAME ='app_link') THEN - alter table t_ds_task_instance modify column app_link varchar(5999); + ALTER TABLE t_ds_task_instance CHANGE COLUMN app_link app_link text COMMENT 'yarn app id'; END IF; END; diff --git a/sql/upgrade/1.2.2_schema/postgresql/dolphinscheduler_ddl.sql b/sql/upgrade/1.2.2_schema/postgresql/dolphinscheduler_ddl.sql index d3201598c85b..b1e0fd941c57 100644 --- a/sql/upgrade/1.2.2_schema/postgresql/dolphinscheduler_ddl.sql +++ b/sql/upgrade/1.2.2_schema/postgresql/dolphinscheduler_ddl.sql @@ -58,7 +58,7 @@ BEGIN WHERE TABLE_NAME='t_ds_task_instance' AND COLUMN_NAME ='app_link') THEN - ALTER TABLE t_ds_task_instance ALTER COLUMN app_link character varying(5999); + ALTER TABLE t_ds_task_instance ALTER COLUMN app_link type text; END IF; END; $$ LANGUAGE plpgsql; @@ -66,4 +66,4 @@ d// delimiter ; SELECT uc_dolphin_T_t_ds_task_instance_C_app_link(); -DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_task_instance_C_app_link(); +DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_task_instance_C_app_link(); \ No newline at end of file