[CP] 【cp】patch dbms_scheduler 421bp7 bugfix
This commit is contained in:
parent
e4b2343022
commit
3b425920cb
@ -373,7 +373,7 @@ int ObDBMSSchedJobMaster::scheduler_job(ObDBMSSchedJobKey *job_key)
|
||||
|
||||
const int64_t now = ObTimeUtility::current_time();
|
||||
int64_t next_check_date = now + MIN_SCHEDULER_INTERVAL;
|
||||
if (OB_FAIL(ret) || !job_info.valid() || job_info.is_disabled() || job_info.is_broken()) {
|
||||
if (OB_FAIL(ret) || !job_info.valid() || job_info.is_broken()) {
|
||||
free_job_key(job_key);
|
||||
job_key = NULL;
|
||||
} else if (job_info.is_running()) {
|
||||
@ -385,6 +385,9 @@ int ObDBMSSchedJobMaster::scheduler_job(ObDBMSSchedJobKey *job_key)
|
||||
LOG_WARN("job is timeout, force update for end", K(job_info), K(now));
|
||||
}
|
||||
}
|
||||
} else if (job_info.is_disabled()) {
|
||||
free_job_key(job_key);
|
||||
job_key = NULL;
|
||||
} else if (now > job_info.get_end_date()) {
|
||||
int tmp = OB_SUCCESS;
|
||||
if (OB_SUCCESS != (tmp = table_operator_.update_for_enddate(job_info))) {
|
||||
@ -419,6 +422,7 @@ int ObDBMSSchedJobMaster::scheduler_job(ObDBMSSchedJobKey *job_key)
|
||||
LOG_WARN("failed to run job", K(ret), K(job_info), KPC(job_key));
|
||||
} else {
|
||||
next_check_date = min(new_next_date, now + CHECK_NEW_INTERVAL);
|
||||
next_check_date = min(next_check_date, now + TO_TS(job_info.get_max_run_duration()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ int ObDBMSSchedJobUtils::init_env(
|
||||
if (OB_SUCC(ret) && user_infos.count() > 1) {
|
||||
OZ(reserve_user_with_minimun_id(user_infos));
|
||||
}
|
||||
OV (1 == user_infos.count(), OB_ERR_UNEXPECTED, K(job_info), K(user_infos));
|
||||
OV (1 == user_infos.count(), 0 == user_infos.count() ? OB_USER_NOT_EXIST : OB_ERR_UNEXPECTED, K(job_info), K(user_infos));
|
||||
CK (OB_NOT_NULL(user_info = user_infos.at(0)));
|
||||
} else {
|
||||
ObString user_name;
|
||||
|
@ -146,13 +146,15 @@ int ObDBMSSchedTableOperator::_build_job_finished_dml(int64_t now, ObDBMSSchedJo
|
||||
OZ (dml.add_column("state", job_info.state_));
|
||||
if (0 == job_info.state_.case_compare("COMPLETED")) {
|
||||
OZ (dml.add_column("enabled", false));
|
||||
} else if (0 == job_info.state_.case_compare("BROKEN")) {
|
||||
OZ (dml.add_time_column("next_date", 64060560000000000));
|
||||
}
|
||||
OZ (dml.add_column(true, "this_date"));
|
||||
OZ (dml.add_time_column("last_date", job_info.this_date_));
|
||||
OZ (dml.add_time_column("next_date", job_info.next_date_));
|
||||
OZ (dml.add_column("failures", job_info.failures_));
|
||||
OZ (dml.add_column("flag", job_info.flag_));
|
||||
OZ (dml.add_column("total", job_info.total_));
|
||||
OZ (dml.get_extra_condition().assign_fmt("state!='BROKEN' AND (last_date is null OR last_date<=usec_to_time(%ld))", job_info.last_date_));
|
||||
OZ (dml.splice_update_sql(OB_ALL_TENANT_SCHEDULER_JOB_TNAME, sql));
|
||||
return ret;
|
||||
}
|
||||
@ -168,6 +170,7 @@ int ObDBMSSchedTableOperator::_build_job_rollback_start_dml(ObDBMSSchedJobInfo &
|
||||
OZ (dml.add_pk_column("job", job_info.job_));
|
||||
OZ (dml.add_pk_column("job_name", job_info.job_name_));
|
||||
OZ (dml.add_column(true, "this_date"));
|
||||
OZ (dml.add_time_column("next_date", job_info.next_date_));// roll back to old next date
|
||||
OZ (dml.splice_update_sql(OB_ALL_TENANT_SCHEDULER_JOB_TNAME, sql));
|
||||
return ret;
|
||||
}
|
||||
@ -327,10 +330,10 @@ int ObDBMSSchedTableOperator::update_for_end(ObDBMSSchedJobInfo &job_info, int e
|
||||
OX (job_info.total_ += (job_info.this_date_ > 0 ? now - job_info.this_date_ : 0));
|
||||
if (OB_SUCC(ret) && ((job_info.flag_ & 0x1) != 0)) {
|
||||
// when if failures > 16 then set broken state.
|
||||
job_info.next_date_ = 64060560000000000; // 4000-01-01
|
||||
job_info.state_ = ObString("BROKEN");
|
||||
} else if (now >= job_info.end_date_) {
|
||||
} else if (now >= job_info.end_date_ || job_info.get_interval_ts() == 0) {
|
||||
// when end_date is reach and auto_drop is set false, disable set completed state.
|
||||
// for once job, not wait until end date, set completed state when running end
|
||||
job_info.state_ = ObString("COMPLETED");
|
||||
}
|
||||
OZ (_build_job_finished_dml(now, job_info, sql1));
|
||||
|
Loading…
x
Reference in New Issue
Block a user