You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by we...@apache.org on 2022/08/18 08:21:17 UTC

[dolphinscheduler] branch dev updated: Set process instance and task priority default value as 2 (#11539)

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

wenjun 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 2862f5b67c Set process instance and task priority default value as 2 (#11539)
2862f5b67c is described below

commit 2862f5b67cace1a91a147f8693d4791bea41be1d
Author: Wenjun Ruan <we...@apache.org>
AuthorDate: Thu Aug 18 16:21:12 2022 +0800

    Set process instance and task priority default value as 2 (#11539)
---
 .../dolphinscheduler/api/controller/SchedulerController.java |  2 +-
 .../src/main/resources/sql/dolphinscheduler_h2.sql           | 12 ++++++------
 .../src/main/resources/sql/dolphinscheduler_mysql.sql        | 12 ++++++------
 .../src/main/resources/sql/dolphinscheduler_postgresql.sql   | 12 ++++++------
 .../sql/upgrade/3.1.0_schema/mysql/dolphinscheduler_ddl.sql  |  8 ++++++++
 .../upgrade/3.1.0_schema/postgresql/dolphinscheduler_ddl.sql |  8 ++++++++
 6 files changed, 35 insertions(+), 19 deletions(-)

diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java
index 33ba596084..cf7f5a5dd7 100644
--- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java
+++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java
@@ -160,7 +160,7 @@ public class SchedulerController extends BaseController {
                                  @RequestParam(value = "failureStrategy", required = false, defaultValue = "END") FailureStrategy failureStrategy,
                                  @RequestParam(value = "workerGroup", required = false, defaultValue = "default") String workerGroup,
                                  @RequestParam(value = "environmentCode", required = false, defaultValue = "-1") Long environmentCode,
-                                 @RequestParam(value = "processInstancePriority", required = false) Priority processInstancePriority) {
+                                 @RequestParam(value = "processInstancePriority", required = false, defaultValue = DEFAULT_PROCESS_INSTANCE_PRIORITY) Priority processInstancePriority) {
 
         Map<String, Object> result = schedulerService.updateSchedule(loginUser, projectCode, id, schedule,
             warningType, warningGroupId, failureStrategy, processInstancePriority, workerGroup, environmentCode);
diff --git a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql
index 9cffb3d11b..5211976ca0 100644
--- a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql
+++ b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql
@@ -331,7 +331,7 @@ CREATE TABLE t_ds_command
     start_time                 datetime DEFAULT NULL,
     executor_id                int(11) DEFAULT NULL,
     update_time                datetime DEFAULT NULL,
-    process_instance_priority  int(11) DEFAULT NULL,
+    process_instance_priority  int(11) DEFAULT '2',
     worker_group               varchar(64),
     environment_code           bigint(20) DEFAULT '-1',
     dry_run                    int NULL DEFAULT 0,
@@ -385,7 +385,7 @@ CREATE TABLE t_ds_error_command
     schedule_time              datetime DEFAULT NULL,
     start_time                 datetime DEFAULT NULL,
     update_time                datetime DEFAULT NULL,
-    process_instance_priority  int(11) DEFAULT NULL,
+    process_instance_priority  int(11) DEFAULT '2',
     worker_group               varchar(64),
     environment_code           bigint(20) DEFAULT '-1',
     message                    text,
@@ -476,7 +476,7 @@ CREATE TABLE t_ds_task_definition
     task_execute_type       int(11) DEFAULT '0',
     task_params             longtext,
     flag                    tinyint(2) DEFAULT NULL,
-    task_priority           tinyint(4) DEFAULT NULL,
+    task_priority           tinyint(4) DEFAULT '2',
     worker_group            varchar(200) DEFAULT NULL,
     environment_code        bigint(20) DEFAULT '-1',
     fail_retry_times        int(11) DEFAULT NULL,
@@ -512,7 +512,7 @@ CREATE TABLE t_ds_task_definition_log
     task_execute_type       int(11) DEFAULT '0',
     task_params             text,
     flag                    tinyint(2) DEFAULT NULL,
-    task_priority           tinyint(4) DEFAULT NULL,
+    task_priority           tinyint(4) DEFAULT '2',
     worker_group            varchar(200) DEFAULT NULL,
     environment_code        bigint(20) DEFAULT '-1',
     fail_retry_times        int(11) DEFAULT NULL,
@@ -610,7 +610,7 @@ CREATE TABLE t_ds_process_instance
     is_sub_process             int(11) DEFAULT '0',
     executor_id                int(11) NOT NULL,
     history_cmd                text,
-    process_instance_priority  int(11) DEFAULT NULL,
+    process_instance_priority  int(11) DEFAULT '2',
     worker_group               varchar(64)  DEFAULT NULL,
     environment_code           bigint(20) DEFAULT '-1',
     timeout                    int(11) DEFAULT '0',
@@ -803,7 +803,7 @@ CREATE TABLE t_ds_schedules
     release_state             tinyint(4) NOT NULL,
     warning_type              tinyint(4) NOT NULL,
     warning_group_id          int(11) DEFAULT NULL,
-    process_instance_priority int(11) DEFAULT NULL,
+    process_instance_priority int(11) DEFAULT '2',
     worker_group              varchar(64) DEFAULT '',
     environment_code          bigint(20) DEFAULT '-1',
     create_time               datetime     NOT NULL,
diff --git a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql
index 7d90c95e40..ebddafc793 100644
--- a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql
+++ b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql
@@ -339,7 +339,7 @@ CREATE TABLE `t_ds_command` (
   `start_time`                datetime DEFAULT NULL COMMENT 'start time',
   `executor_id`               int(11) DEFAULT NULL COMMENT 'executor id',
   `update_time`               datetime DEFAULT NULL COMMENT 'update time',
-  `process_instance_priority` int(11) DEFAULT NULL COMMENT 'process instance priority: 0 Highest,1 High,2 Medium,3 Low,4 Lowest',
+  `process_instance_priority` int(11) DEFAULT '2' COMMENT 'process instance priority: 0 Highest,1 High,2 Medium,3 Low,4 Lowest',
   `worker_group`              varchar(64)  COMMENT 'worker group',
   `environment_code`          bigint(20) DEFAULT '-1' COMMENT 'environment code',
   `dry_run`                   tinyint(4) DEFAULT '0' COMMENT 'dry run flag:0 normal, 1 dry run',
@@ -391,7 +391,7 @@ CREATE TABLE `t_ds_error_command` (
   `schedule_time` datetime DEFAULT NULL COMMENT 'scheduler time',
   `start_time` datetime DEFAULT NULL COMMENT 'start time',
   `update_time` datetime DEFAULT NULL COMMENT 'update time',
-  `process_instance_priority` int(11) DEFAULT NULL COMMENT 'process instance priority, 0 Highest,1 High,2 Medium,3 Low,4 Lowest',
+  `process_instance_priority` int(11) DEFAULT '2' COMMENT 'process instance priority, 0 Highest,1 High,2 Medium,3 Low,4 Lowest',
   `worker_group` varchar(64)  COMMENT 'worker group',
   `environment_code` bigint(20) DEFAULT '-1' COMMENT 'environment code',
   `message` text COMMENT 'message',
@@ -476,7 +476,7 @@ CREATE TABLE `t_ds_task_definition` (
   `task_execute_type` int(11) DEFAULT '0' COMMENT 'task execute type: 0-batch, 1-stream',
   `task_params` longtext COMMENT 'job custom parameters',
   `flag` tinyint(2) DEFAULT NULL COMMENT '0 not available, 1 available',
-  `task_priority` tinyint(4) DEFAULT NULL COMMENT 'job priority',
+  `task_priority` tinyint(4) DEFAULT '2' COMMENT 'job priority',
   `worker_group` varchar(200) DEFAULT NULL COMMENT 'worker grouping',
   `environment_code` bigint(20) DEFAULT '-1' COMMENT 'environment code',
   `fail_retry_times` int(11) DEFAULT NULL COMMENT 'number of failed retries',
@@ -511,7 +511,7 @@ CREATE TABLE `t_ds_task_definition_log` (
   `task_execute_type` int(11) DEFAULT '0' COMMENT 'task execute type: 0-batch, 1-stream',
   `task_params` longtext COMMENT 'job custom parameters',
   `flag` tinyint(2) DEFAULT NULL COMMENT '0 not available, 1 available',
-  `task_priority` tinyint(4) DEFAULT NULL COMMENT 'job priority',
+  `task_priority` tinyint(4) DEFAULT '2' COMMENT 'job priority',
   `worker_group` varchar(200) DEFAULT NULL COMMENT 'worker grouping',
   `environment_code` bigint(20) DEFAULT '-1' COMMENT 'environment code',
   `fail_retry_times` int(11) DEFAULT NULL COMMENT 'number of failed retries',
@@ -612,7 +612,7 @@ CREATE TABLE `t_ds_process_instance` (
   `is_sub_process` int(11) DEFAULT '0' COMMENT 'flag, whether the process is sub process',
   `executor_id` int(11) NOT NULL COMMENT 'executor id',
   `history_cmd` text COMMENT 'history commands of process instance operation',
-  `process_instance_priority` int(11) DEFAULT NULL COMMENT 'process instance priority. 0 Highest,1 High,2 Medium,3 Low,4 Lowest',
+  `process_instance_priority` int(11) DEFAULT '2' COMMENT 'process instance priority. 0 Highest,1 High,2 Medium,3 Low,4 Lowest',
   `worker_group` varchar(64) DEFAULT NULL COMMENT 'worker group id',
   `environment_code` bigint(20) DEFAULT '-1' COMMENT 'environment code',
   `timeout` int(11) DEFAULT '0' COMMENT 'time out',
@@ -800,7 +800,7 @@ CREATE TABLE `t_ds_schedules` (
   `release_state` tinyint(4) NOT NULL COMMENT 'release state. 0:offline,1:online ',
   `warning_type` tinyint(4) NOT NULL COMMENT 'Alarm type: 0 is not sent, 1 process is sent successfully, 2 process is sent failed, 3 process is sent successfully and all failures are sent',
   `warning_group_id` int(11) DEFAULT NULL COMMENT 'alert group id',
-  `process_instance_priority` int(11) DEFAULT NULL COMMENT 'process instance priority:0 Highest,1 High,2 Medium,3 Low,4 Lowest',
+  `process_instance_priority` int(11) DEFAULT '2' COMMENT 'process instance priority:0 Highest,1 High,2 Medium,3 Low,4 Lowest',
   `worker_group` varchar(64) DEFAULT '' COMMENT 'worker group id',
   `environment_code` bigint(20) DEFAULT '-1' COMMENT 'environment code',
   `create_time` datetime NOT NULL COMMENT 'create time',
diff --git a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql
index 067607c82c..e4c0923bbb 100644
--- a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql
+++ b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql
@@ -262,7 +262,7 @@ CREATE TABLE t_ds_command (
   start_time                timestamp DEFAULT NULL ,
   executor_id               int DEFAULT NULL ,
   update_time               timestamp DEFAULT NULL ,
-  process_instance_priority int DEFAULT NULL ,
+  process_instance_priority int DEFAULT '2' ,
   worker_group              varchar(64),
   environment_code          bigint DEFAULT '-1',
   dry_run                   int DEFAULT '0' ,
@@ -309,7 +309,7 @@ CREATE TABLE t_ds_error_command (
   start_time                timestamp DEFAULT NULL ,
   executor_id               int DEFAULT NULL ,
   update_time               timestamp DEFAULT NULL ,
-  process_instance_priority int DEFAULT NULL ,
+  process_instance_priority int DEFAULT '2' ,
   worker_group              varchar(64),
   environment_code          bigint DEFAULT '-1',
   dry_run                   int DEFAULT '0' ,
@@ -393,7 +393,7 @@ CREATE TABLE t_ds_task_definition (
   task_execute_type int DEFAULT '0',
   task_params text ,
   flag int DEFAULT NULL ,
-  task_priority int DEFAULT NULL ,
+  task_priority int DEFAULT '2' ,
   worker_group varchar(255) DEFAULT NULL ,
   environment_code bigint DEFAULT '-1',
   fail_retry_times int DEFAULT NULL ,
@@ -431,7 +431,7 @@ CREATE TABLE t_ds_task_definition_log (
   task_execute_type int(11) DEFAULT '0',
   task_params text ,
   flag int DEFAULT NULL ,
-  task_priority int DEFAULT NULL ,
+  task_priority int DEFAULT '2' ,
   worker_group varchar(255) DEFAULT NULL ,
   environment_code bigint DEFAULT '-1',
   fail_retry_times int DEFAULT NULL ,
@@ -540,7 +540,7 @@ CREATE TABLE t_ds_process_instance (
   executor_id int NOT NULL ,
   history_cmd text ,
   dependence_schedule_times text ,
-  process_instance_priority int DEFAULT NULL ,
+  process_instance_priority int DEFAULT '2' ,
   worker_group varchar(64) ,
   environment_code bigint DEFAULT '-1',
   timeout int DEFAULT '0' ,
@@ -711,7 +711,7 @@ CREATE TABLE t_ds_schedules (
   release_state int NOT NULL ,
   warning_type int NOT NULL ,
   warning_group_id int DEFAULT NULL ,
-  process_instance_priority int DEFAULT NULL ,
+  process_instance_priority int DEFAULT '2' ,
   worker_group varchar(64),
   environment_code bigint DEFAULT '-1',
   create_time timestamp NOT NULL ,
diff --git a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.0_schema/mysql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.0_schema/mysql/dolphinscheduler_ddl.sql
index a5c302e7f7..ddf91f5238 100644
--- a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.0_schema/mysql/dolphinscheduler_ddl.sql
+++ b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.0_schema/mysql/dolphinscheduler_ddl.sql
@@ -390,3 +390,11 @@ d//
 delimiter ;
 CALL modify_t_ds_task_group_col_description;
 DROP PROCEDURE modify_t_ds_task_group_col_description;
+
+alter table t_ds_process_instance alter column process_instance_priority set default 2;
+alter table t_ds_schedules alter column process_instance_priority set default 2;
+alter table t_ds_command alter column process_instance_priority set default 2;
+alter table t_ds_error_command alter column process_instance_priority set default 2;
+
+alter table t_ds_task_definition_log alter column task_priority set default 2;
+alter table t_ds_task_definition alter column task_priority set default 2;
diff --git a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.0_schema/postgresql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.0_schema/postgresql/dolphinscheduler_ddl.sql
index 00958fbab6..0ce3722bec 100644
--- a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.0_schema/postgresql/dolphinscheduler_ddl.sql
+++ b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.1.0_schema/postgresql/dolphinscheduler_ddl.sql
@@ -57,6 +57,14 @@ CREATE TABLE IF NOT EXISTS "t_ds_cluster" (
     CONSTRAINT cluster_code_unique UNIQUE (code)
 );
 
+--- set process_instance_priority and task_priority default value as 2
+alter table t_ds_process_instance alter column process_instance_priority set default 2;
+alter table t_ds_schedules alter column process_instance_priority set default 2;
+alter table t_ds_command alter column process_instance_priority set default 2;
+alter table t_ds_error_command alter column process_instance_priority set default 2;
+alter table t_ds_task_definition_log alter column task_priority set default 2;
+alter table t_ds_task_definition alter column task_priority set default 2;
+
 --- add column
 ALTER TABLE t_ds_task_definition ADD COLUMN IF NOT EXISTS task_execute_type int DEFAULT '0';
 ALTER TABLE t_ds_task_definition_log ADD COLUMN IF NOT EXISTS task_execute_type int DEFAULT '0';