fix spm evolution task can not finish due to add plan failed

This commit is contained in:
obdev
2024-05-09 15:06:09 +00:00
committed by ob-robot
parent 7f64a468c6
commit fd298c183d
10 changed files with 3 additions and 21 deletions

View File

@ -975,20 +975,17 @@ OB_INLINE int ObMPQuery::do_process(ObSQLSessionInfo &session,
if (!(ctx_.self_add_plan_) && ctx_.plan_cache_hit_) {
plan->update_plan_stat(audit_record,
false, // false mean not first update plan stat
result.get_exec_context().get_is_evolution(),
table_row_count_list);
plan->update_cache_access_stat(audit_record.table_scan_stat_);
} else if (ctx_.self_add_plan_ && !ctx_.plan_cache_hit_) {
plan->update_plan_stat(audit_record,
true,
result.get_exec_context().get_is_evolution(),
table_row_count_list);
plan->update_cache_access_stat(audit_record.table_scan_stat_);
} else if (ctx_.self_add_plan_ && ctx_.plan_cache_hit_) {
// spm evolution plan first execute
plan->update_plan_stat(audit_record,
true,
result.get_exec_context().get_is_evolution(),
table_row_count_list);
plan->update_cache_access_stat(audit_record.table_scan_stat_);
}

View File

@ -1405,20 +1405,17 @@ int ObMPStmtExecute::do_process(ObSQLSessionInfo &session,
if (!(ctx_.self_add_plan_) && ctx_.plan_cache_hit_) {
plan->update_plan_stat(audit_record,
false, // false mean not first update plan stat
result.get_exec_context().get_is_evolution(),
table_row_count_list);
plan->update_cache_access_stat(audit_record.table_scan_stat_);
} else if (ctx_.self_add_plan_ && !ctx_.plan_cache_hit_) {
plan->update_plan_stat(audit_record,
true,
result.get_exec_context().get_is_evolution(),
table_row_count_list);
plan->update_cache_access_stat(audit_record.table_scan_stat_);
} else if (ctx_.self_add_plan_ && ctx_.plan_cache_hit_) {
// spm evolution plan first execute
plan->update_plan_stat(audit_record,
true,
result.get_exec_context().get_is_evolution(),
table_row_count_list);
plan->update_cache_access_stat(audit_record.table_scan_stat_);
}

View File

@ -639,12 +639,10 @@ int ObInnerSQLConnection::process_audit_record(sql::ObResultSet &result_set,
if (!(sql_ctx.self_add_plan_) && sql_ctx.plan_cache_hit_) {
plan->update_plan_stat(audit_record,
false, // false mean not first update plan stat
result_set.get_exec_context().get_is_evolution(),
table_row_count_list);
} else if (sql_ctx.self_add_plan_ && !sql_ctx.plan_cache_hit_) {
plan->update_plan_stat(audit_record,
true,
result_set.get_exec_context().get_is_evolution(),
table_row_count_list);
}
}

View File

@ -92,7 +92,6 @@ ObExecContext::ObExecContext(ObIAllocator &allocator)
row_id_list_(nullptr),
row_id_list_array_(),
total_row_count_(0),
is_evolution_(false),
reusable_interm_result_(false),
is_async_end_trans_(false),
gi_task_map_(nullptr),

View File

@ -383,8 +383,6 @@ public:
int64_t get_row_id_list_total_count() const { return total_row_count_; }
void set_plan_start_time(int64_t t) { phy_plan_ctx_->set_plan_start_time(t); }
int64_t get_plan_start_time() const { return phy_plan_ctx_->get_plan_start_time(); }
void set_is_evolution(bool v) { is_evolution_ = v; }
bool get_is_evolution() const { return is_evolution_; }
void set_is_ps_prepare_stage(bool v) { is_ps_prepare_stage_ = v; }
bool is_ps_prepare_stage() const { return is_ps_prepare_stage_; }
@ -590,9 +588,6 @@ protected:
ObRowIdListArray row_id_list_array_;
//判断现在执行的计划是否为演进过程中的计划
int64_t total_row_count_;
// -----------------------
bool is_evolution_;
// Interminate result of index building is reusable, reused in build index retry with same snapshot.
// Reusable intermediate result is not deleted in the close phase, deleted deliberately after
// execution is completed.

View File

@ -473,7 +473,6 @@ int ObPhysicalPlan::init_operator_stats()
void ObPhysicalPlan::update_plan_stat(const ObAuditRecordData &record,
const bool is_first,
const bool is_evolution,
const ObIArray<ObTableRowCount> *table_row_count_list)
{
const int64_t current_time = ObClockGenerator::getClock();

View File

@ -126,7 +126,6 @@ public:
*/
void update_plan_stat(const ObAuditRecordData &record,
const bool is_first,
const bool is_evolution,
const ObIArray<ObTableRowCount> *table_row_count_list);
void update_cache_access_stat(const ObTableScanStat &scan_stat)
{

View File

@ -612,12 +612,10 @@ void ObRemoteBaseExecuteP<T>::record_sql_audit_and_plan_stat(
if (!exec_ctx_.get_sql_ctx()->self_add_plan_ && exec_ctx_.get_sql_ctx()->plan_cache_hit_) {
mutable_plan->update_plan_stat(audit_record,
false, // false mean not first update plan stat
exec_ctx_.get_is_evolution(),
table_row_count_list);
} else if (exec_ctx_.get_sql_ctx()->self_add_plan_ && !exec_ctx_.get_sql_ctx()->plan_cache_hit_) {
mutable_plan->update_plan_stat(audit_record,
true,
exec_ctx_.get_is_evolution(),
table_row_count_list);
}

View File

@ -3952,7 +3952,7 @@ int ObSql::execute_get_plan(ObPlanCache &plan_cache,
if (OB_SQL_PC_NOT_EXIST == ret || OB_PC_LOCK_CONFLICT == ret) {
// do nothing
} else {
LOG_WARN("fail to get physical plan", K(ret));
LOG_WARN("fail to get physical plan", K(ret), KPC(guard.get_cache_obj()));
}
}
}

View File

@ -139,8 +139,8 @@ private:
bool &is_same) const;
int is_evolving_plan_better(bool &is_better) const;
int process_plan_evolution_result(const bool is_better);
int discard_evolving_plan_add_baseline_plan_to_pc(ObPlanCacheCtx &ctx);
int discard_baseline_plan_add_evolving_plan_to_pc(ObPlanCacheCtx &ctx);
void discard_evolving_plan_add_baseline_plan_to_pc(ObPlanCacheCtx &ctx);
void discard_baseline_plan_add_evolving_plan_to_pc(ObPlanCacheCtx &ctx);
int discard_all_plan_by_type(EvolutionPlanType plan_type, bool evict_plan = false);
int add_evolving_plan_to_pc(ObPlanCacheCtx &ctx);
int add_all_baseline_plans_to_pc(ObPlanCacheCtx &ctx);