精简Log表

v1.9.2
xuxueli 6 years ago
parent 700b3dd351
commit 9ac897f5db

@ -176,7 +176,6 @@ CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_LOG` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`job_group` int(11) NOT NULL COMMENT '执行器主键ID', `job_group` int(11) NOT NULL COMMENT '执行器主键ID',
`job_id` 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_address` varchar(255) DEFAULT NULL COMMENT '执行器地址,本次执行的地址',
`executor_handler` varchar(255) DEFAULT NULL COMMENT '执行器任务handler', `executor_handler` varchar(255) DEFAULT NULL COMMENT '执行器任务handler',
`executor_param` varchar(512) DEFAULT NULL COMMENT '执行器任务参数', `executor_param` varchar(512) DEFAULT NULL COMMENT '执行器任务参数',

@ -14,9 +14,6 @@ public class XxlJobLog {
private int jobGroup; private int jobGroup;
private int jobId; private int jobId;
// glueType
private String glueType;
// execute info // execute info
private String executorAddress; private String executorAddress;
private String executorHandler; private String executorHandler;
@ -57,14 +54,6 @@ public class XxlJobLog {
this.jobId = jobId; this.jobId = jobId;
} }
public String getGlueType() {
return glueType;
}
public void setGlueType(String glueType) {
this.glueType = glueType;
}
public String getExecutorAddress() { public String getExecutorAddress() {
return executorAddress; return executorAddress;
} }

@ -70,7 +70,6 @@ public class XxlJobTrigger {
// 2、prepare trigger-info // 2、prepare trigger-info
//jobLog.setExecutorAddress(executorAddress); //jobLog.setExecutorAddress(executorAddress);
jobLog.setGlueType(jobInfo.getGlueType());
jobLog.setExecutorHandler(jobInfo.getExecutorHandler()); jobLog.setExecutorHandler(jobInfo.getExecutorHandler());
jobLog.setExecutorParam(jobInfo.getExecutorParam()); jobLog.setExecutorParam(jobInfo.getExecutorParam());
jobLog.setExecutorFailRetryCount(finalFailRetryCount); 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()); 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) { if (triggerResult.getCode()!=ReturnT.SUCCESS_CODE) {
onceFailed = true; 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>"); 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.setExecutorAddress(triggerResult.getContent());
jobLog.setTriggerCode(triggerResult.getCode()); jobLog.setTriggerCode(triggerResult.getCode());
jobLog.setTriggerMsg(triggerMsgSb.toString()); jobLog.setTriggerMsg(triggerMsgSb.toString());
XxlJobDynamicScheduler.xxlJobLogDao.updateTriggerInfo(jobLog); XxlJobDynamicScheduler.xxlJobLogDao.updateTriggerInfo(jobLog);
// 5、monitor trigger // 6、monitor trigger
JobFailMonitorHelper.monitor(jobLog.getId()); JobFailMonitorHelper.monitor(jobLog.getId());
logger.debug(">>>>>>>>>>> xxl-job trigger end, jobId:{}", jobLog.getId()); logger.debug(">>>>>>>>>>> xxl-job trigger end, jobId:{}", jobLog.getId());
@ -140,7 +139,6 @@ public class XxlJobTrigger {
// 2、prepare trigger-info // 2、prepare trigger-info
//jobLog.setExecutorAddress(executorAddress); //jobLog.setExecutorAddress(executorAddress);
jobLog.setGlueType(jobInfo.getGlueType());
jobLog.setExecutorHandler(jobInfo.getExecutorHandler()); jobLog.setExecutorHandler(jobInfo.getExecutorHandler());
jobLog.setExecutorParam(jobInfo.getExecutorParam()); jobLog.setExecutorParam(jobInfo.getExecutorParam());
jobLog.setExecutorFailRetryCount(finalFailRetryCount); jobLog.setExecutorFailRetryCount(finalFailRetryCount);
@ -181,20 +179,22 @@ public class XxlJobTrigger {
triggerResult = executorRouteStrategyEnum.getRouter().routeRun(triggerParam, addressList); triggerResult = executorRouteStrategyEnum.getRouter().routeRun(triggerParam, addressList);
triggerMsgSb.append("<br><br><span style=\"color:#00c0ef;\" > >>>>>>>>>>>"+ I18nUtil.getString("jobconf_trigger_run") +"<<<<<<<<<<< </span><br>").append(triggerResult.getMsg()); 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 && finalFailRetryCount > 0) { if (triggerResult.getCode()!=ReturnT.SUCCESS_CODE && finalFailRetryCount > 0) {
JobTriggerPoolHelper.trigger(jobId, (finalFailRetryCount-1)); JobTriggerPoolHelper.trigger(jobId, (finalFailRetryCount-1));
triggerMsgSb.append("<br><br><span style=\"color:#F39C12;\" > >>>>>>>>>>>"+ I18nUtil.getString("jobconf_fail_trigger_retry") +"<<<<<<<<<<< </span><br>"); 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.setExecutorAddress(triggerResult.getContent());
jobLog.setTriggerCode(triggerResult.getCode()); jobLog.setTriggerCode(triggerResult.getCode());
jobLog.setTriggerMsg(triggerMsgSb.toString()); jobLog.setTriggerMsg(triggerMsgSb.toString());
XxlJobDynamicScheduler.xxlJobLogDao.updateTriggerInfo(jobLog); XxlJobDynamicScheduler.xxlJobLogDao.updateTriggerInfo(jobLog);
// 5、monitor trigger // 6、monitor trigger
JobFailMonitorHelper.monitor(jobLog.getId()); JobFailMonitorHelper.monitor(jobLog.getId());
logger.debug(">>>>>>>>>>> xxl-job trigger end, jobId:{}", jobLog.getId()); logger.debug(">>>>>>>>>>> xxl-job trigger end, jobId:{}", jobLog.getId());
} }

@ -96,6 +96,8 @@ public class AdminBizImpl implements AdminBiz {
if (log.getExecutorFailRetryCount() > 0) { if (log.getExecutorFailRetryCount() > 0) {
int nextFailRetryCount = log.getExecutorFailRetryCount()-1; int nextFailRetryCount = log.getExecutorFailRetryCount()-1;
// TODO广播路由的失败重试会导致重试暴增需要优化
JobTriggerPoolHelper.trigger(log.getJobId(), nextFailRetryCount); JobTriggerPoolHelper.trigger(log.getJobId(), nextFailRetryCount);
callbackMsg = "<br><br><span style=\"color:#F39C12;\" > >>>>>>>>>>>"+ I18nUtil.getString("jobconf_fail_handle_retry") +"<<<<<<<<<<< </span><br>"; 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_group" property="jobGroup" />
<result column="job_id" property="jobId" /> <result column="job_id" property="jobId" />
<result column="glue_type" property="glueType" />
<result column="executor_address" property="executorAddress" /> <result column="executor_address" property="executorAddress" />
<result column="executor_handler" property="executorHandler" /> <result column="executor_handler" property="executorHandler" />
<result column="executor_param" property="executorParam" /> <result column="executor_param" property="executorParam" />
@ -30,7 +28,6 @@
t.id, t.id,
t.job_group, t.job_group,
t.job_id, t.job_id,
t.glue_type,
t.executor_address, t.executor_address,
t.executor_handler, t.executor_handler,
t.executor_param, t.executor_param,
@ -136,7 +133,6 @@
<update id="updateTriggerInfo" > <update id="updateTriggerInfo" >
UPDATE XXL_JOB_QRTZ_TRIGGER_LOG UPDATE XXL_JOB_QRTZ_TRIGGER_LOG
SET SET
`glue_type`= #{glueType},
`trigger_time`= #{triggerTime}, `trigger_time`= #{triggerTime},
`trigger_code`= #{triggerCode}, `trigger_code`= #{triggerCode},
`trigger_msg`= #{triggerMsg}, `trigger_msg`= #{triggerMsg},

Loading…
Cancel
Save