[CP] bugfix: thread deadlock caused by local retries

This commit is contained in:
leslieyuchen
2023-10-11 09:39:34 +00:00
committed by ob-robot
parent 4ec2a9f224
commit 11be84be20
7 changed files with 11 additions and 13 deletions

View File

@ -37,7 +37,7 @@ int ObDASCtx::init(const ObPhysicalPlan &plan, ObExecContext &ctx)
const ObIArray<ObTableLocation> &normal_locations = plan.get_table_locations();
const ObIArray<ObTableLocation> &das_locations = plan.get_das_table_locations();
location_router_.set_last_errno(ctx.get_my_session()->get_retry_info().get_last_query_retry_err());
location_router_.set_total_retry_cnt(ctx.get_my_session()->get_retry_info().get_retry_cnt());
location_router_.set_history_retry_cnt(ctx.get_my_session()->get_retry_info().get_retry_cnt());
for (int64_t i = 0; OB_SUCC(ret) && i < das_locations.count(); ++i) {
const ObTableLocation &das_location = das_locations.at(i);
ObDASTableLoc *table_loc = nullptr;

View File

@ -743,7 +743,7 @@ int ObDASTabletMapper::get_partition_id_map(ObObjectID partition_id,
ObDASLocationRouter::ObDASLocationRouter(ObIAllocator &allocator)
: last_errno_(OB_SUCCESS),
cur_errno_(OB_SUCCESS),
total_retry_cnt_(0),
history_retry_cnt_(0),
cur_retry_cnt_(0),
all_tablet_list_(allocator),
succ_tablet_list_(allocator),
@ -1238,7 +1238,7 @@ int ObDASLocationRouter::block_renew_tablet_location(const ObTabletID &tablet_id
void ObDASLocationRouter::set_retry_info(const ObQueryRetryInfo* retry_info)
{
last_errno_ = retry_info->get_last_query_retry_err();
total_retry_cnt_ = retry_info->get_retry_cnt();
history_retry_cnt_ = retry_info->get_retry_cnt();
}
int ObDASLocationRouter::get_external_table_ls_location(ObLSLocation &location)

View File

@ -310,13 +310,13 @@ public:
int save_touched_tablet_id(const common::ObTabletID &tablet_id) { return all_tablet_list_.push_back(tablet_id); }
void set_last_errno(int err_no) { last_errno_ = err_no; }
int get_last_errno() const { return last_errno_; }
void set_total_retry_cnt(int64_t total_retry_cnt) { total_retry_cnt_ = total_retry_cnt; }
void set_history_retry_cnt(int64_t history_retry_cnt) { history_retry_cnt_ = history_retry_cnt; }
void accumulate_retry_count()
{
total_retry_cnt_ += cur_retry_cnt_;
history_retry_cnt_ += cur_retry_cnt_;
cur_retry_cnt_ = 0;
}
int64_t get_total_retry_cnt() const { return total_retry_cnt_; }
int64_t get_total_retry_cnt() const { return history_retry_cnt_ + cur_retry_cnt_; }
int64_t get_cur_retry_cnt() const { return cur_retry_cnt_; }
void reset_cur_retry_cnt() { cur_retry_cnt_ = 0; }
void inc_cur_retry_cnt() { ++cur_retry_cnt_; }
@ -345,7 +345,7 @@ private:
private:
int last_errno_;
int cur_errno_;
int64_t total_retry_cnt_;
int64_t history_retry_cnt_; //Total number of retries before the current retry round.
int64_t cur_retry_cnt_; // the counter of continuous retry
// NOTE: Only all_tablet_list_ needs to be serialized and send to other server to perform das remote execution;
// And other members will be collected by execution server self, No need to perform serialization;

View File

@ -248,6 +248,7 @@ int ObDataAccessService::retry_das_task(ObDASRef &das_ref, ObIDASTaskOp &task_op
bool retry_continue = false;
ObDASLocationRouter &location_router = DAS_CTX(das_ref.get_exec_ctx()).get_location_router();
location_router.reset_cur_retry_cnt();
oceanbase::lib::Thread::WaitGuard guard(oceanbase::lib::Thread::WAIT_FOR_LOCAL_RETRY);
do {
ObDASRetryCtrl::retry_func retry_func = nullptr;
@ -277,7 +278,6 @@ int ObDataAccessService::retry_das_task(ObDASRef &das_ref, ObIDASTaskOp &task_op
task_op.in_part_retry_ = true;
location_router.set_last_errno(task_op.get_errcode());
location_router.inc_cur_retry_cnt();
oceanbase::lib::Thread::WaitGuard guard(oceanbase::lib::Thread::WAIT_FOR_LOCAL_RETRY);
if (OB_TMP_FAIL(clear_task_exec_env(das_ref, task_op))) {
LOG_WARN("clear task execution environment failed", K(tmp_ret));
}