From 9ac897f5dbc74a0a81f917bc6d4ac49ae8682de4 Mon Sep 17 00:00:00 2001
From: xuxueli <931591021@qq.com>
Date: Sun, 19 Aug 2018 00:06:20 +0800
Subject: [PATCH] =?UTF-8?q?=E7=B2=BE=E7=AE=80Log=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
doc/db/tables_xxl_job.sql | 1 -
.../xxl/job/admin/core/model/XxlJobLog.java | 11 ---------
.../job/admin/core/trigger/XxlJobTrigger.java | 24 +++++++++----------
.../job/admin/service/impl/AdminBizImpl.java | 2 ++
.../mybatis-mapper/XxlJobLogMapper.xml | 4 ----
5 files changed, 14 insertions(+), 28 deletions(-)
diff --git a/doc/db/tables_xxl_job.sql b/doc/db/tables_xxl_job.sql
index 8d88fb64..a07a1b8f 100644
--- a/doc/db/tables_xxl_job.sql
+++ b/doc/db/tables_xxl_job.sql
@@ -176,7 +176,6 @@ CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_LOG` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`job_group` int(11) NOT NULL COMMENT '执行器主键ID',
`job_id` int(11) NOT NULL COMMENT '任务,主键ID',
- `glue_type` varchar(50) DEFAULT NULL COMMENT 'GLUE类型',
`executor_address` varchar(255) DEFAULT NULL COMMENT '执行器地址,本次执行的地址',
`executor_handler` varchar(255) DEFAULT NULL COMMENT '执行器任务handler',
`executor_param` varchar(512) DEFAULT NULL COMMENT '执行器任务参数',
diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLog.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLog.java
index b668f44a..33340e37 100644
--- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLog.java
+++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLog.java
@@ -14,9 +14,6 @@ public class XxlJobLog {
private int jobGroup;
private int jobId;
- // glueType
- private String glueType;
-
// execute info
private String executorAddress;
private String executorHandler;
@@ -57,14 +54,6 @@ public class XxlJobLog {
this.jobId = jobId;
}
- public String getGlueType() {
- return glueType;
- }
-
- public void setGlueType(String glueType) {
- this.glueType = glueType;
- }
-
public String getExecutorAddress() {
return executorAddress;
}
diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java
index 174816ab..e01d1cc5 100644
--- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java
+++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java
@@ -70,7 +70,6 @@ public class XxlJobTrigger {
// 2、prepare trigger-info
//jobLog.setExecutorAddress(executorAddress);
- jobLog.setGlueType(jobInfo.getGlueType());
jobLog.setExecutorHandler(jobInfo.getExecutorHandler());
jobLog.setExecutorParam(jobInfo.getExecutorParam());
jobLog.setExecutorFailRetryCount(finalFailRetryCount);
@@ -108,7 +107,7 @@ public class XxlJobTrigger {
triggerMsgSb.append("
>>>>>>>>>>>"+ I18nUtil.getString("jobconf_trigger_run") +"<<<<<<<<<<<
").append(triggerResult.getMsg());
- // 3.3、trigger (fail retry)
+ // 4、fail retry)
if (triggerResult.getCode()!=ReturnT.SUCCESS_CODE) {
onceFailed = true;
}
@@ -118,13 +117,13 @@ public class XxlJobTrigger {
triggerMsgSb.append("
>>>>>>>>>>>"+ I18nUtil.getString("jobconf_fail_trigger_retry") +"<<<<<<<<<<<
");
}
- // 4、save trigger-info
+ // 5、save trigger-info
jobLog.setExecutorAddress(triggerResult.getContent());
jobLog.setTriggerCode(triggerResult.getCode());
jobLog.setTriggerMsg(triggerMsgSb.toString());
XxlJobDynamicScheduler.xxlJobLogDao.updateTriggerInfo(jobLog);
- // 5、monitor trigger
+ // 6、monitor trigger
JobFailMonitorHelper.monitor(jobLog.getId());
logger.debug(">>>>>>>>>>> xxl-job trigger end, jobId:{}", jobLog.getId());
@@ -140,7 +139,6 @@ public class XxlJobTrigger {
// 2、prepare trigger-info
//jobLog.setExecutorAddress(executorAddress);
- jobLog.setGlueType(jobInfo.getGlueType());
jobLog.setExecutorHandler(jobInfo.getExecutorHandler());
jobLog.setExecutorParam(jobInfo.getExecutorParam());
jobLog.setExecutorFailRetryCount(finalFailRetryCount);
@@ -181,20 +179,22 @@ public class XxlJobTrigger {
triggerResult = executorRouteStrategyEnum.getRouter().routeRun(triggerParam, addressList);
triggerMsgSb.append("
>>>>>>>>>>>"+ I18nUtil.getString("jobconf_trigger_run") +"<<<<<<<<<<<
").append(triggerResult.getMsg());
- // 3.3、trigger (fail retry)
- if (triggerResult.getCode()!=ReturnT.SUCCESS_CODE && finalFailRetryCount > 0) {
- JobTriggerPoolHelper.trigger(jobId, (finalFailRetryCount-1));
- triggerMsgSb.append("
>>>>>>>>>>>"+ I18nUtil.getString("jobconf_fail_trigger_retry") +"<<<<<<<<<<<
");
- }
+
+ }
+
+ // 4、fail retry
+ if (triggerResult.getCode()!=ReturnT.SUCCESS_CODE && finalFailRetryCount > 0) {
+ JobTriggerPoolHelper.trigger(jobId, (finalFailRetryCount-1));
+ triggerMsgSb.append("
>>>>>>>>>>>"+ I18nUtil.getString("jobconf_fail_trigger_retry") +"<<<<<<<<<<<
");
}
- // 4、save trigger-info
+ // 5、save trigger-info
jobLog.setExecutorAddress(triggerResult.getContent());
jobLog.setTriggerCode(triggerResult.getCode());
jobLog.setTriggerMsg(triggerMsgSb.toString());
XxlJobDynamicScheduler.xxlJobLogDao.updateTriggerInfo(jobLog);
- // 5、monitor trigger
+ // 6、monitor trigger
JobFailMonitorHelper.monitor(jobLog.getId());
logger.debug(">>>>>>>>>>> xxl-job trigger end, jobId:{}", jobLog.getId());
}
diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/AdminBizImpl.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/AdminBizImpl.java
index 5ae05c7b..c31b3c20 100644
--- a/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/AdminBizImpl.java
+++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/AdminBizImpl.java
@@ -96,6 +96,8 @@ public class AdminBizImpl implements AdminBiz {
if (log.getExecutorFailRetryCount() > 0) {
int nextFailRetryCount = log.getExecutorFailRetryCount()-1;
+ // TODO,广播路由的失败重试,会导致重试暴增,需要优化
+
JobTriggerPoolHelper.trigger(log.getJobId(), nextFailRetryCount);
callbackMsg = "
>>>>>>>>>>>"+ I18nUtil.getString("jobconf_fail_handle_retry") +"<<<<<<<<<<<
";
diff --git a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml
index 99757ead..bc0aa8ec 100644
--- a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml
+++ b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml
@@ -9,8 +9,6 @@
-
-
@@ -30,7 +28,6 @@
t.id,
t.job_group,
t.job_id,
- t.glue_type,
t.executor_address,
t.executor_handler,
t.executor_param,
@@ -136,7 +133,6 @@
UPDATE XXL_JOB_QRTZ_TRIGGER_LOG
SET
- `glue_type`= #{glueType},
`trigger_time`= #{triggerTime},
`trigger_code`= #{triggerCode},
`trigger_msg`= #{triggerMsg},