Jelajahi Sumber

合并PR-3518,日志表索引优化,提升大日志量情况下日志清理速度;

xuxueli 10 bulan lalu
induk
melakukan
5f2dd5b23a
2 mengubah file dengan 7 tambahan dan 1 penghapusan
  1. 1 0
      doc/XXL-JOB官方文档.md
  2. 6 1
      doc/db/tables_xxl_job.sql

+ 1 - 0
doc/XXL-JOB官方文档.md

@@ -2410,6 +2410,7 @@ public void execute() {
 - 8、【优化】合并PR-3605,避免子任务是任务本身导致死循环;
 - 9、【修复】合并PR-3585,修复全局密码长度不一致问题;
 - 10、【优化】合并PR-3518,将列别名反引号包裹,提升跨数据迁移兼容性;
+- 11、【优化】合并PR-3518,日志表索引优化,提升大日志量情况下日志清理速度;
 
 - 4、[规划中]升级springboot3.x,解决2.x老版本漏洞类问题。注意,springboot3.x依赖jdk17;
 - 5、[规划中]安全功能增强,通讯加密参数改用加密数据避免AccessToken明文, 降低token泄漏风险;

+ 6 - 1
doc/db/tables_xxl_job.sql

@@ -56,7 +56,9 @@ CREATE TABLE `xxl_job_log`
     `alarm_status`              tinyint(4) NOT NULL DEFAULT '0' COMMENT '告警状态:0-默认、1-无需告警、2-告警成功、3-告警失败',
     PRIMARY KEY (`id`),
     KEY `I_trigger_time` (`trigger_time`),
-    KEY `I_handle_code` (`handle_code`)
+    KEY `I_handle_code` (`handle_code`),
+    KEY `I_jobid_jobgroup` (`job_id`,`job_group`),
+    KEY `I_job_id` (`job_id`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
 
@@ -134,6 +136,7 @@ CREATE TABLE `xxl_job_lock`
 
 INSERT INTO `xxl_job_group`(`id`, `app_name`, `title`, `address_type`, `address_list`, `update_time`)
 VALUES (1, 'xxl-job-executor-sample', '示例执行器', 0, NULL, '2018-11-03 22:21:31');
+
 INSERT INTO `xxl_job_info`(`id`, `job_group`, `job_desc`, `add_time`, `update_time`, `author`, `alarm_email`,
                            `schedule_type`, `schedule_conf`, `misfire_strategy`, `executor_route_strategy`,
                            `executor_handler`, `executor_param`, `executor_block_strategy`, `executor_timeout`,
@@ -142,8 +145,10 @@ INSERT INTO `xxl_job_info`(`id`, `job_group`, `job_desc`, `add_time`, `update_ti
 VALUES (1, 1, '测试任务1', '2018-11-03 22:21:31', '2018-11-03 22:21:31', 'XXL', '', 'CRON', '0 0 0 * * ? *',
         'DO_NOTHING', 'FIRST', 'demoJobHandler', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN', '', 'GLUE代码初始化',
         '2018-11-03 22:21:31', '');
+
 INSERT INTO `xxl_job_user`(`id`, `username`, `password`, `role`, `permission`)
 VALUES (1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', 1, NULL);
+
 INSERT INTO `xxl_job_lock` (`lock_name`)
 VALUES ('schedule_lock');