OB_TIMEOUT need rewrite to OB_ERR_EXCLUSIVE_LOCK_CONFLICT during query retry ctrl in some case.

This commit is contained in:
obdev
2023-03-02 15:20:47 +00:00
committed by ob-robot
parent 2e7b3899b4
commit bc3ddbb0af
3 changed files with 14 additions and 5 deletions

View File

@ -744,6 +744,13 @@ void ObQueryRetryCtrl::switch_consumer_group_retry_proc(ObRetryParam &v)
retry_obj.test(switch_group_retry); retry_obj.test(switch_group_retry);
} }
void ObQueryRetryCtrl::timeout_proc(ObRetryParam &v)
{
if (is_try_lock_row_err(v.session_.get_retry_info().get_last_query_retry_err())) {
v.client_ret_ = OB_ERR_EXCLUSIVE_LOCK_CONFLICT;
v.retry_type_ = RETRY_TYPE_NONE;
}
}
/////// For inner SQL only /////////////// /////// For inner SQL only ///////////////
void ObQueryRetryCtrl::inner_try_lock_row_conflict_proc(ObRetryParam &v) void ObQueryRetryCtrl::inner_try_lock_row_conflict_proc(ObRetryParam &v)
@ -832,9 +839,6 @@ void ObQueryRetryCtrl::empty_proc(ObRetryParam &v)
// 根据"给用户返回导致不重试的最后一个错误码"的原则, // 根据"给用户返回导致不重试的最后一个错误码"的原则,
// 这里是err不在重试错误码列表中的情况,需要将client_ret设置为相应的值 // 这里是err不在重试错误码列表中的情况,需要将client_ret设置为相应的值
v.client_ret_ = v.err_; v.client_ret_ = v.err_;
if (is_timeout_err(v.err_) && is_try_lock_row_err(v.session_.get_retry_info().get_last_query_retry_err())) {
v.client_ret_ = OB_ERR_EXCLUSIVE_LOCK_CONFLICT;
}
v.retry_type_ = RETRY_TYPE_NONE; v.retry_type_ = RETRY_TYPE_NONE;
if (OB_ERR_PROXY_REROUTE != v.client_ret_) { if (OB_ERR_PROXY_REROUTE != v.client_ret_) {
LOG_DEBUG("no retry handler for this err code, no need retry", K(v), LOG_DEBUG("no retry handler for this err code, no need retry", K(v),
@ -979,6 +983,11 @@ int ObQueryRetryCtrl::init()
ERR_RETRY_FUNC("SQL", OB_SQL_RETRY_SPM, force_local_retry_proc, force_local_retry_proc); ERR_RETRY_FUNC("SQL", OB_SQL_RETRY_SPM, force_local_retry_proc, force_local_retry_proc);
ERR_RETRY_FUNC("SQL", OB_NEED_SWITCH_CONSUMER_GROUP, switch_consumer_group_retry_proc, empty_proc); ERR_RETRY_FUNC("SQL", OB_NEED_SWITCH_CONSUMER_GROUP, switch_consumer_group_retry_proc, empty_proc);
/* timeout */
ERR_RETRY_FUNC("SQL", OB_TIMEOUT, timeout_proc, timeout_proc);
ERR_RETRY_FUNC("SQL", OB_TRANS_TIMEOUT, timeout_proc, timeout_proc);
ERR_RETRY_FUNC("SQL", OB_TRANS_STMT_TIMEOUT, timeout_proc, timeout_proc);
/* ddl */ /* ddl */

View File

@ -299,6 +299,7 @@ private:
static void short_wait_retry_proc(ObRetryParam &v); static void short_wait_retry_proc(ObRetryParam &v);
static void force_local_retry_proc(ObRetryParam &v); static void force_local_retry_proc(ObRetryParam &v);
static void switch_consumer_group_retry_proc(ObRetryParam &v); static void switch_consumer_group_retry_proc(ObRetryParam &v);
static void timeout_proc(ObRetryParam &v);
// processors for inner SQL error codes only // processors for inner SQL error codes only

View File

@ -72,7 +72,6 @@ public:
history_exec_time_(0), history_exec_time_(0),
is_inited_(false), is_inited_(false),
current_stage_cnt_(0), current_stage_cnt_(0),
evolution_finish_count_(0),
lazy_finished_(false), lazy_finished_(false),
lazy_better_(false) lazy_better_(false)
{ {
@ -152,6 +151,7 @@ private:
ObPlanCacheCtx &ctx, ObPlanCacheCtx &ctx,
ObPhysicalPlan *&plan); ObPhysicalPlan *&plan);
int64_t get_baseline_plan_error_cnt(); int64_t get_baseline_plan_error_cnt();
int64_t get_plan_finish_cnt();
protected: protected:
ObSqlPlanSet *plan_set_; ObSqlPlanSet *plan_set_;
@ -173,7 +173,6 @@ protected:
bool is_evo_best_plan_; bool is_evo_best_plan_;
int64_t best_plan_cnt_; int64_t best_plan_cnt_;
int64_t current_stage_cnt_; int64_t current_stage_cnt_;
int64_t evolution_finish_count_;
bool lazy_finished_; bool lazy_finished_;
bool lazy_better_; bool lazy_better_;
}; };