[CP] avoid ddl task spin
This commit is contained in:
parent
59253e749c
commit
4116c8fb03
@ -924,7 +924,7 @@ void ObDDLScheduler::run1()
|
||||
}
|
||||
if (do_idle) {
|
||||
first_retry_task = nullptr;
|
||||
idler_.idle(10 * 1000L);
|
||||
idler_.idle(ObDDLTask::DEFAULT_TASK_IDLE_TIME_US);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1114,6 +1114,7 @@ int ObDDLTask::switch_status(const ObDDLTaskStatus new_status, const bool enable
|
||||
if (OB_SUCC(ret) && old_status != real_new_status) {
|
||||
add_event_info(real_new_status, dst_tenant_id_);
|
||||
task_status_ = real_new_status;
|
||||
next_schedule_ts_ = 0; // when status changed, schedule immediately
|
||||
LOG_INFO("ddl_scheduler switch status", K(ret), "ddl_event_info", ObDDLEventInfo(), K(task_status_));
|
||||
}
|
||||
|
||||
@ -1458,6 +1459,11 @@ void ObDDLTask::calc_next_schedule_ts(const int ret_code, const int64_t total_ta
|
||||
next_schedule_ts_ = ObTimeUtility::current_time() + ObRandom::rand(min_dt, max_dt);
|
||||
} else {
|
||||
delay_schedule_time_ = 0;
|
||||
if (next_schedule_ts_ > 0) {
|
||||
// if next_schedule_ts_ is set, means that the task is not to schedule immediately.
|
||||
// make sure it will be delayed at least 10ms to awoid spin
|
||||
next_schedule_ts_ = max(next_schedule_ts_, ObTimeUtility::current_time() + DEFAULT_TASK_IDLE_TIME_US);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -578,6 +578,7 @@ public:
|
||||
K_(next_schedule_ts), K_(delay_schedule_time), K(execution_id_), K(sql_exec_addr_), K_(data_format_version), K(consumer_group_id_),
|
||||
K_(dst_tenant_id), K_(dst_schema_version));
|
||||
static const int64_t MAX_ERR_TOLERANCE_CNT = 3L; // Max torlerance count for error code.
|
||||
static const int64_t DEFAULT_TASK_IDLE_TIME_US = 10L * 1000L; // 10ms
|
||||
protected:
|
||||
int gather_redefinition_stats(const uint64_t tenant_id,
|
||||
const int64_t task_id,
|
||||
|
Loading…
x
Reference in New Issue
Block a user