[4.2] fix core problem because of display tasks

This commit is contained in:
joseph12138 2023-06-29 06:12:27 +00:00 committed by ob-robot
parent 865f0a38ea
commit e015d11370
6 changed files with 11 additions and 6 deletions

View File

@ -22,7 +22,7 @@ const ObLatchDesc OB_LATCHES[] = {
#undef LATCH_DEF
};
static_assert(ARRAYSIZEOF(OB_LATCHES) == 306, "DO NOT delete latch defination");
static_assert(ARRAYSIZEOF(OB_LATCHES) == 307, "DO NOT delete latch defination");
static_assert(ObLatchIds::LATCH_END == ARRAYSIZEOF(OB_LATCHES) - 1, "update id of LATCH_END before adding your defination");
}

View File

@ -316,8 +316,9 @@ LATCH_DEF(ALL_SERVERS_INFO_IN_TABLE_LOCK, 301, "all servers info in table lock",
LATCH_DEF(OPT_STAT_GATHER_STAT_LOCK, 302, "optimizer stat gather stat lock", LATCH_FIFO, 2000, 0, OPT_STAT_GATHER_STAT_LOCK_WAIT, "optimizer stat gather stat lock")
LATCH_DEF(DUP_TABLET_LOCK, 303, "dup tablet lock", LATCH_FIFO, 2000, 0, DUP_TABLET_LOCK_WAIT, "dup tablet lock")
LATCH_DEF(TENANT_IO_POOL_LOCK, 304, "tenant io allocator lock", LATCH_FIFO, 2000, 0, TENANT_IO_POOL_WAIT, "tenant io pool lock")
LATCH_DEF(DISPLAY_TASKS_LOCK, 305, "display tasks lock", LATCH_READ_PREFER, 2000, 0, DISPLAY_TASKS_LOCK_WAIT, "display tasks lock")
LATCH_DEF(LATCH_END, 305, "latch end", LATCH_FIFO, 2000, 0, WAIT_EVENT_END, "latch end")
LATCH_DEF(LATCH_END, 306, "latch end", LATCH_FIFO, 2000, 0, WAIT_EVENT_END, "latch end")
#endif
#ifndef OB_LATCH_DEFINE_H_

View File

@ -304,6 +304,7 @@ WAIT_EVENT_DEF(HB_RESPONSES_LOCK_WAIT, 15258, "latch: hb responses lock wait", "
WAIT_EVENT_DEF(ALL_SERVERS_INFO_IN_TABLE_LOCK_WAIT, 15259, "latch: all servers info in table lock wait", "address", "number", "tries", CONCURRENCY, "latch: all servers info in table lock wait", true)
WAIT_EVENT_DEF(OPT_STAT_GATHER_STAT_LOCK_WAIT, 15260, "latch: optimizer stat gather stat lock wait", "address", "number", "tries", CONCURRENCY, "latch: optimizer stat gather stat lock wait", true)
WAIT_EVENT_DEF(TENANT_IO_POOL_WAIT, 15261, "rwlock: tenant io pool wait", "address", "number", "tries", CONCURRENCY, "rwlock: tenant io pool wait", true)
WAIT_EVENT_DEF(DISPLAY_TASKS_LOCK_WAIT, 15262, "latch: display tasks lock wait", "address", "number", "tries", CONCURRENCY, "latch: display tasks lock wait", true)
//transaction
WAIT_EVENT_DEF(END_TRANS_WAIT, 16001, "wait end trans", "rollback", "trans_hash_value", "participant_count", COMMIT,"wait end trans", false)

View File

@ -1653,7 +1653,8 @@ ObDRWorker::ObDRWorker(volatile bool &stop)
rpc_proxy_(nullptr),
sql_proxy_(nullptr),
task_count_statistic_(),
display_tasks_()
display_tasks_(),
display_tasks_rwlock_(ObLatchIds::DISPLAY_TASKS_LOCK)
{
}
@ -4579,6 +4580,7 @@ int ObDRWorker::get_task_plan_display(
common::ObSArray<ObLSReplicaTaskDisplayInfo> &task_plan)
{
int ret = OB_SUCCESS;
SpinWLockGuard guard(display_tasks_rwlock_);
task_plan.reset();
if (OB_UNLIKELY(!inited_)) {
ret = OB_NOT_INIT;
@ -4586,12 +4588,14 @@ int ObDRWorker::get_task_plan_display(
} else if (OB_FAIL(task_plan.assign(display_tasks_))) {
LOG_WARN("fail to get dsplay task stat", KR(ret), K_(display_tasks));
}
reset_task_plans_();
return ret;
}
int ObDRWorker::add_display_info(const ObLSReplicaTaskDisplayInfo &display_info)
{
int ret = OB_SUCCESS;
SpinWLockGuard guard(display_tasks_rwlock_);
if (OB_UNLIKELY(!inited_)) {
ret = OB_NOT_INIT;
LOG_WARN("not init", KR(ret));

View File

@ -127,7 +127,6 @@ public:
bool &locality_is_matched);
inline int64_t get_display_task_count_() const { return display_tasks_.count(); }
void reset_task_plans() { display_tasks_.reset(); }
int get_task_plan_display(
common::ObSArray<ObLSReplicaTaskDisplayInfo> &task_plan);
@ -675,6 +674,7 @@ private:
bool &has_leader);
private:
void reset_task_plans_() { display_tasks_.reset(); }
int check_task_already_exist(
const ObDRTaskKey &task_key,
@ -1053,6 +1053,7 @@ private:
common::ObMySQLProxy *sql_proxy_;
TaskCountStatistic task_count_statistic_;
common::ObSArray<ObLSReplicaTaskDisplayInfo> display_tasks_;
common::SpinRWLock display_tasks_rwlock_; // to protect display_tasks_
};
} // end namespace rootserver
} // end namespace oceanbase

View File

@ -110,8 +110,6 @@ int ObAllVirtualLSReplicaTaskPlan::inner_get_next_row(ObNewRow *&row)
}
}
task_worker_->reset_task_plans();
if (OB_SUCC(ret)) {
scanner_it_ = scanner_.begin();
start_to_read_ = true;