精简Log表

master
xuxueli 6 years ago
parent 700b3dd351
commit 9ac897f5db
  1. 1
      doc/db/tables_xxl_job.sql
  2. 11
      xxl-job-admin/src/main/java/com/xxl/job/admin/core/model/XxlJobLog.java
  3. 24
      xxl-job-admin/src/main/java/com/xxl/job/admin/core/trigger/XxlJobTrigger.java
  4. 2
      xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/AdminBizImpl.java
  5. 4
      xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml

@ -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 '执行器任务参数',

@ -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;
}

@ -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("<br><br><span style=\"color:#00c0ef;\" > >>>>>>>>>>>"+ I18nUtil.getString("jobconf_trigger_run") +"<<<<<<<<<<< </span><br>").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("<br><br><span style=\"color:#F39C12;\" > >>>>>>>>>>>"+ I18nUtil.getString("jobconf_fail_trigger_retry") +"<<<<<<<<<<< </span><br>");
}
// 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("<br><br><span style=\"color:#00c0ef;\" > >>>>>>>>>>>"+ I18nUtil.getString("jobconf_trigger_run") +"<<<<<<<<<<< </span><br>").append(triggerResult.getMsg());
// 3.3、trigger (fail retry)
if (triggerResult.getCode()!=ReturnT.SUCCESS_CODE && finalFailRetryCount > 0) {
JobTriggerPoolHelper.trigger(jobId, (finalFailRetryCount-1));
triggerMsgSb.append("<br><br><span style=\"color:#F39C12;\" > >>>>>>>>>>>"+ I18nUtil.getString("jobconf_fail_trigger_retry") +"<<<<<<<<<<< </span><br>");
}
}
// 4、fail retry
if (triggerResult.getCode()!=ReturnT.SUCCESS_CODE && finalFailRetryCount > 0) {
JobTriggerPoolHelper.trigger(jobId, (finalFailRetryCount-1));
triggerMsgSb.append("<br><br><span style=\"color:#F39C12;\" > >>>>>>>>>>>"+ I18nUtil.getString("jobconf_fail_trigger_retry") +"<<<<<<<<<<< </span><br>");
}
// 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());
}

@ -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 = "<br><br><span style=\"color:#F39C12;\" > >>>>>>>>>>>"+ I18nUtil.getString("jobconf_fail_handle_retry") +"<<<<<<<<<<< </span><br>";

@ -9,8 +9,6 @@
<result column="job_group" property="jobGroup" />
<result column="job_id" property="jobId" />
<result column="glue_type" property="glueType" />
<result column="executor_address" property="executorAddress" />
<result column="executor_handler" property="executorHandler" />
<result column="executor_param" property="executorParam" />
@ -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 id="updateTriggerInfo" >
UPDATE XXL_JOB_QRTZ_TRIGGER_LOG
SET
`glue_type`= #{glueType},
`trigger_time`= #{triggerTime},
`trigger_code`= #{triggerCode},
`trigger_msg`= #{triggerMsg},

Loading…
Cancel
Save