[CP] fix spm add baseline concurrent bug

This commit is contained in:
xxyd 2024-12-11 03:18:02 +00:00 committed by ob-robot
parent 4205b19369
commit 86b40ebc71
5 changed files with 4 additions and 12 deletions

View File

@ -5234,9 +5234,6 @@ OB_NOINLINE int ObSql::handle_physical_plan(const ObString &trimed_stmt,
// baseline and execute this plan directly.
need_get_baseline = false;
spm_ctx.baseline_exists_ = false;
} else {
// add baseline plan failed, need evict unaccepted baseline in baseline cache.
(void) ObSpmController::deny_new_plan_as_baseline(spm_ctx);
}
} else if (plan_added && ObSpmCacheCtx::SpmStat::STAT_ADD_BASELINE_PLAN == spm_ctx.spm_stat_) {
if ((nullptr != spm_ctx.baseline_guard_.get_cache_obj() &&
@ -5284,7 +5281,9 @@ OB_NOINLINE int ObSql::handle_physical_plan(const ObString &trimed_stmt,
} else if (!plan_added) {
// plan not add to plan cache, do not check if need evolution.
if (spm_ctx.check_execute_status_) {
(void) ObSpmController::deny_new_plan_as_baseline(spm_ctx);
// session which add plan succeed need check execute status
spm_ctx.check_execute_status_ = false;
LOG_TRACE("plan not add, disable check execute status");
}
} else if (baseline_enable && !baseline_exists) {
need_get_baseline = true;

View File

@ -6051,8 +6051,6 @@ int ObSQLUtils::handle_plan_baseline(const ObAuditRecordData &audit_record,
if (OB_FAIL(ObSpmController::accept_new_plan_as_baseline(sql_ctx.spm_ctx_, audit_record))) {
LOG_WARN("failed to accept new plan as baseline", K(ret));
}
} else if (OB_FAIL(ObSpmController::deny_new_plan_as_baseline(sql_ctx.spm_ctx_))) {
LOG_WARN("failed to deny new plan as baseline", K(ret));
}
return ret;
}

View File

@ -137,7 +137,6 @@ public:
int64_t &baseline_affected);
int load_baseline(ObSpmBaselineLoader &baseline_loader);
int purge_baselines(const uint64_t tenant_id, int64_t baseline_affected);
int evict_plan_baseline(ObSpmCacheCtx& spm_ctx);
int check_evolution_task();
int handle_spm_evo_record(const uint64_t tenant_id);
private:

View File

@ -41,7 +41,6 @@ public:
static int accept_plan_baseline_by_user(obrpc::ObModifyPlanBaselineArg& arg);
static int cancel_evolve_task(obrpc::ObModifyPlanBaselineArg& arg);
static int load_baseline(ObSpmBaselineLoader &baseline_loader);
static int deny_new_plan_as_baseline(ObSpmCacheCtx& spm_ctx);
static int64_t calc_spm_timeout_us(const int64_t normal_timeout, const int64_t baseline_exec_time);
};

View File

@ -105,7 +105,6 @@ public:
executions_(0),
elapsed_time_(UINT64_MAX),
cpu_time_( UINT64_MAX),
need_evict_(false),
need_sync_(false) {}
virtual ~ObPlanBaselineItem() { destroy(); }
@ -178,8 +177,6 @@ public:
inline void set_elapsed_time(int64_t v) { elapsed_time_ = v; }
inline int64_t get_cpu_time() const { return cpu_time_; }
inline void set_cpu_time(int64_t v) { cpu_time_ = v; }
inline bool get_need_evict() const { return need_evict_; }
inline void set_need_evict(bool v) { need_evict_ = v; }
inline bool get_need_sync() const { return need_sync_; }
inline void set_need_sync(bool v) { need_sync_ = v; }
@ -207,7 +204,6 @@ public:
int64_t cpu_time_; // The total CPU time consumed during the evolution process
// common::ObString hints_info_;
// for lib cache management
bool need_evict_;
bool need_sync_;
private:
DISALLOW_COPY_AND_ASSIGN(ObPlanBaselineItem);
@ -238,6 +234,7 @@ public:
void destroy();
void set_baseline_key(ObBaselineKey &key) { baseline_key_ = key; }
ObBaselineKey &get_baseline_key() { return baseline_key_; }
bool check_has_accepted_baseline() const;
TO_STRING_KV(K_(is_inited));
private: