You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ji...@apache.org on 2022/01/26 05:33:29 UTC

[dolphinscheduler] branch dev updated: to improvement #8192 (#8193)

This is an automated email from the ASF dual-hosted git repository.

jinyleechina pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new aeb7d89  to improvement #8192 (#8193)
aeb7d89 is described below

commit aeb7d89c50dc6d67d4bbc7e80f311a9e8c5ea7b0
Author: ouyangyewei <ou...@foxmail.com>
AuthorDate: Wed Jan 26 13:32:17 2022 +0800

    to improvement #8192 (#8193)
    
    Co-authored-by: ouyangyewei <ye...@alibaba-inc.com>
---
 .../src/main/resources/sql/dolphinscheduler_mysql.sql               | 4 +++-
 .../src/main/resources/sql/dolphinscheduler_postgresql.sql          | 3 +++
 .../sql/upgrade/2.1.0_schema/mysql/dolphinscheduler_ddl.sql         | 2 ++
 .../sql/upgrade/2.1.0_schema/postgresql/dolphinscheduler_ddl.sql    | 6 ++++++
 4 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql
index c13b006..0cbfca9 100644
--- a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql
+++ b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql
@@ -516,7 +516,8 @@ CREATE TABLE `t_ds_task_definition_log` (
   `create_time` datetime NOT NULL COMMENT 'create time',
   `update_time` datetime NOT NULL COMMENT 'update time',
   PRIMARY KEY (`id`),
-  KEY `idx_code_version` (`code`,`version`)
+  KEY `idx_code_version` (`code`,`version`),
+  KEY `idx_project_code` (`project_code`)
 ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
 
 -- ----------------------------
@@ -844,6 +845,7 @@ CREATE TABLE `t_ds_task_instance` (
   `dry_run` tinyint(4) DEFAULT '0' COMMENT 'dry run flag: 0 normal, 1 dry run',
   PRIMARY KEY (`id`),
   KEY `process_instance_id` (`process_instance_id`) USING BTREE,
+  KEY `idx_code_version` (`task_code`, `task_definition_version`) USING BTREE,
   CONSTRAINT `foreign_key_instance_id` FOREIGN KEY (`process_instance_id`) REFERENCES `t_ds_process_instance` (`id`) ON DELETE CASCADE
 ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
 
diff --git a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql
index 48df778..ec13254 100644
--- a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql
+++ b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql
@@ -437,6 +437,7 @@ CREATE TABLE t_ds_task_definition_log (
 ) ;
 
 create index idx_task_definition_log_code_version on t_ds_task_definition_log (code,version);
+create index idx_task_definition_log_project_code on t_ds_task_definition_log (project_code);
 
 --
 -- Table structure for table t_ds_process_task_relation
@@ -749,6 +750,8 @@ CREATE TABLE t_ds_task_instance (
   CONSTRAINT foreign_key_instance_id FOREIGN KEY(process_instance_id) REFERENCES t_ds_process_instance(id) ON DELETE CASCADE
 ) ;
 
+create index idx_task_instance_code_version on t_ds_task_instance (task_code, task_definition_version);
+
 --
 -- Table structure for table t_ds_tenant
 --
diff --git a/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.1.0_schema/mysql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.1.0_schema/mysql/dolphinscheduler_ddl.sql
index e0d6673..22ae472 100644
--- a/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.1.0_schema/mysql/dolphinscheduler_ddl.sql
+++ b/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.1.0_schema/mysql/dolphinscheduler_ddl.sql
@@ -15,10 +15,12 @@
  * limitations under the License.
 */
 
+ALTER TABLE `t_ds_task_instance` ADD INDEX `idx_code_version` (`task_code`, `task_definition_version`) USING BTREE;
 ALTER TABLE `t_ds_task_instance` MODIFY COLUMN `task_params` longtext COMMENT 'job custom parameters' AFTER `app_link`;
 ALTER TABLE `t_ds_process_task_relation` ADD KEY `idx_code` (`project_code`, `process_definition_code`) USING BTREE;
 ALTER TABLE `t_ds_process_task_relation_log` ADD KEY `idx_process_code_version` (`process_definition_code`,`process_definition_version`) USING BTREE;
 
+ALTER TABLE `t_ds_task_definition_log` ADD INDEX `idx_project_code` (`project_code`) USING BTREE;
 ALTER TABLE `t_ds_task_definition_log` ADD INDEX `idx_code_version` (`code`,`version`) USING BTREE;
 alter table t_ds_task_definition_log add `task_group_id` int(11) DEFAULT NULL COMMENT 'task group id' AFTER `resource_ids`;
 alter table t_ds_task_definition_log add `task_group_priority` int(11) DEFAULT NULL COMMENT 'task group id' AFTER `task_group_id`;
diff --git a/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.1.0_schema/postgresql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.1.0_schema/postgresql/dolphinscheduler_ddl.sql
index 992cc77..b76908d 100644
--- a/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.1.0_schema/postgresql/dolphinscheduler_ddl.sql
+++ b/dolphinscheduler-dao/src/main/resources/sql/upgrade/2.1.0_schema/postgresql/dolphinscheduler_ddl.sql
@@ -38,6 +38,12 @@ EXECUTE 'CREATE INDEX IF NOT EXISTS process_task_relation_log_idx_project_code_p
 EXECUTE 'DROP INDEX IF EXISTS "idx_task_definition_log_code_version"';
 EXECUTE 'CREATE INDEX IF NOT EXISTS idx_task_definition_log_code_version ON ' || quote_ident(v_schema) ||'.t_ds_task_definition_log USING Btree("code","version")';
 
+EXECUTE 'DROP INDEX IF EXISTS "idx_task_definition_log_project_code"';
+EXECUTE 'CREATE INDEX IF NOT EXISTS idx_task_definition_log_project_code ON ' || quote_ident(v_schema) ||'.t_ds_task_definition_log USING Btree("project_code")';
+
+EXECUTE 'DROP INDEX IF EXISTS "idx_task_instance_code_version"';
+EXECUTE 'CREATE INDEX IF NOT EXISTS idx_task_instance_code_version ON' || quote_ident(v_schema) ||'.t_ds_task_instance USING Btree("task_code","task_definition_version")';
+
 return 'Success!';
 exception when others then
 		---Raise EXCEPTION '(%)',SQLERRM;