Skip to content

Commit

Permalink
feature: 原子操作能力支持滚动执行 TencentBlueKing#446
Browse files Browse the repository at this point in the history
定义web API
  • Loading branch information
wangyu096 committed Jan 6, 2022
1 parent 610694a commit 5d9e1b2
Showing 1 changed file with 69 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,31 +60,33 @@ CREATE TABLE IF NOT EXISTS `task_instance`

CREATE TABLE IF NOT EXISTS `step_instance`
(
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`step_id` bigint(20) NOT NULL,
`task_instance_id` bigint(20) NOT NULL,
`app_id` bigint(20) NOT NULL,
`name` varchar(512) DEFAULT NULL,
`type` tinyint(4) NOT NULL,
`operator` varchar(128) DEFAULT NULL,
`status` tinyint(4) NOT NULL DEFAULT '1',
`execute_count` int(11) NOT NULL DEFAULT '0',
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`step_id` bigint(20) NOT NULL,
`task_instance_id` bigint(20) NOT NULL,
`app_id` bigint(20) NOT NULL,
`name` varchar(512) DEFAULT NULL,
`type` tinyint(4) NOT NULL,
`operator` varchar(128) DEFAULT NULL,
`status` tinyint(4) NOT NULL DEFAULT '1',
`execute_count` int(11) NOT NULL DEFAULT '0',
`batch` smallint(6) NOT NULL DEFAULT '0',
`target_servers` longtext,
`abnormal_agent_ip_list` longtext,
`start_time` bigint(20) DEFAULT NULL,
`end_time` bigint(20) DEFAULT NULL,
`total_time` bigint(20) DEFAULT NULL,
`total_ip_num` int(11) DEFAULT '0',
`abnormal_agent_num` int(11) DEFAULT '0',
`run_ip_num` int(11) DEFAULT '0',
`fail_ip_num` int(11) DEFAULT '0',
`success_ip_num` int(11) DEFAULT '0',
`create_time` bigint(20) DEFAULT NULL,
`ignore_error` tinyint(4) NOT NULL DEFAULT 0,
`step_num` int(11) NOT NULL DEFAULT 0,
`step_order` int(11) NOT NULL DEFAULT 0,
`row_create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`row_update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`start_time` bigint(20) DEFAULT NULL,
`end_time` bigint(20) DEFAULT NULL,
`total_time` bigint(20) DEFAULT NULL,
`total_ip_num` int(11) DEFAULT '0',
`abnormal_agent_num` int(11) DEFAULT '0',
`run_ip_num` int(11) DEFAULT '0',
`fail_ip_num` int(11) DEFAULT '0',
`success_ip_num` int(11) DEFAULT '0',
`create_time` bigint(20) DEFAULT NULL,
`ignore_error` tinyint(4) NOT NULL DEFAULT 0,
`step_num` int(11) NOT NULL DEFAULT 0,
`step_order` int(11) NOT NULL DEFAULT 0,
`rolling_config_id` bigint(20) DEFAULT NULL,
`row_create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`row_update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY (`task_instance_id`)
) ENGINE = InnoDB
Expand Down Expand Up @@ -153,16 +155,16 @@ CREATE TABLE IF NOT EXISTS `step_instance_confirm`

CREATE TABLE IF NOT EXISTS `gse_task_log`
(
`step_instance_id` bigint(20) NOT NULL DEFAULT '0',
`execute_count` int(11) NOT NULL DEFAULT '0',
`batch` smallint(6) NOT NULL DEFAULT '0',
`start_time` bigint(20) DEFAULT NULL,
`end_time` bigint(20) DEFAULT NULL,
`total_time` bigint(11) DEFAULT NULL,
`status` tinyint(4) DEFAULT '1',
`gse_task_id` varchar(64) DEFAULT NULL,
`row_create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`row_update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`step_instance_id` bigint(20) NOT NULL DEFAULT '0',
`execute_count` int(11) NOT NULL DEFAULT '0',
`batch` smallint(6) NOT NULL DEFAULT '0',
`start_time` bigint(20) DEFAULT NULL,
`end_time` bigint(20) DEFAULT NULL,
`total_time` bigint(11) DEFAULT NULL,
`status` tinyint(4) DEFAULT '1',
`gse_task_id` varchar(64) DEFAULT NULL,
`row_create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`row_update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`step_instance_id`, `execute_count`, `batch`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
Expand All @@ -171,7 +173,7 @@ CREATE TABLE IF NOT EXISTS `gse_task_ip_log`
(
`step_instance_id` bigint(20) NOT NULL,
`execute_count` int(11) NOT NULL DEFAULT '0',
`batch` smallint(6) NOT NULL DEFAULT '0',
`batch` smallint(6) NOT NULL DEFAULT '0',
`ip` varchar(30) NOT NULL,
`status` int(11) DEFAULT '1',
`start_time` bigint(20) DEFAULT NULL,
Expand Down Expand Up @@ -223,31 +225,32 @@ CREATE TABLE IF NOT EXISTS `task_instance_variable`

CREATE TABLE IF NOT EXISTS `dangerous_record`
(
`row_create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`row_update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`rule_id` bigint(20) NOT NULL,
`rule_expression` varchar(255) NOT NULL,
`app_id` bigint(20) NOT NULL,
`row_create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`row_update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`rule_id` bigint(20) NOT NULL,
`rule_expression` varchar(255) NOT NULL,
`app_id` bigint(20) NOT NULL,
`app_name` varchar(1024) NOT NULL,
`operator` varchar(128) NOT NULL,
`script_language` tinyint(4) NOT NULL,
`script_content` longtext NOT NULL,
`create_time` bigint(20) NOT NULL,
`startup_mode` tinyint(4) NOT NULL,
`client` varchar(128) NOT NULL,
`action` tinyint(4) NOT NULL,
`check_result` text NOT NULL,
`ext_data` text,
`operator` varchar(128) NOT NULL,
`script_language` tinyint(4) NOT NULL,
`script_content` longtext NOT NULL,
`create_time` bigint(20) NOT NULL,
`startup_mode` tinyint(4) NOT NULL,
`client` varchar(128) NOT NULL,
`action` tinyint(4) NOT NULL,
`check_result` text NOT NULL,
`ext_data` text,
PRIMARY KEY (`id`),
KEY `idx_create_time_rule_id` (`create_time`,`rule_id`),
KEY `idx_create_time_rule_expression` (`create_time`,`rule_expression`),
KEY `idx_create_time_app_id` (`create_time`,`app_id`),
KEY `idx_create_time_operator` (`create_time`,`operator`),
KEY `idx_create_time_startup_mode` (`create_time`,`startup_mode`),
KEY `idx_create_time_client` (`create_time`,`client`),
KEY `idx_create_time_mode` (`create_time`,`action`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
KEY `idx_create_time_rule_id` (`create_time`, `rule_id`),
KEY `idx_create_time_rule_expression` (`create_time`, `rule_expression`),
KEY `idx_create_time_app_id` (`create_time`, `app_id`),
KEY `idx_create_time_operator` (`create_time`, `operator`),
KEY `idx_create_time_startup_mode` (`create_time`, `startup_mode`),
KEY `idx_create_time_client` (`create_time`, `client`),
KEY `idx_create_time_mode` (`create_time`, `action`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `step_instance_variable`
(
Expand All @@ -264,37 +267,17 @@ CREATE TABLE IF NOT EXISTS `step_instance_variable`
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `rolling_task`
(
`step_instance_id` bigint(20) NOT NULL DEFAULT '0',
`batch` smallint(6) NOT NULL DEFAULT '0',
`execute_count` int(11) NOT NULL DEFAULT '0',
`task_instance_id` bigint(20) NOT NULL DEFAULT '0',
`start_time` bigint(20) DEFAULT NULL,
`end_time` bigint(20) DEFAULT NULL,
`total_time` bigint(11) DEFAULT NULL,
`status` tinyint(4) DEFAULT '1',
`batch_detail` varchar(64) DEFAULT NULL,
`row_create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`row_update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`step_instance_id`, `batch`, `execute_count`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;

CREATE TABLE IF NOT EXISTS `rolling_task`
CREATE TABLE IF NOT EXISTS `rolling_config`
(
`step_instance_id` bigint(20) NOT NULL DEFAULT '0',
`batch` smallint(6) NOT NULL DEFAULT '0',
`execute_count` int(11) NOT NULL DEFAULT '0',
`task_instance_id` bigint(20) NOT NULL DEFAULT '0',
`start_time` bigint(20) DEFAULT NULL,
`end_time` bigint(20) DEFAULT NULL,
`total_time` bigint(11) DEFAULT NULL,
`status` tinyint(4) DEFAULT '1',
`batch_detail` varchar(64) DEFAULT NULL,
`row_create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`row_update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`step_instance_id`, `batch`, `execute_count`)
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`task_instance_id` bigint(20) NOT NULL DEFAULT '0',
`rolling_name` varchar(128) NOT NULL,
`config` longtext NOT NULL,
`row_create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`row_update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY(`id`),
KEY (`task_instance_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;

Expand Down

0 comments on commit 5d9e1b2

Please sign in to comment.