[scn] fix failure of mittest after refresh feature scn
This commit is contained in:
@ -277,24 +277,17 @@ int ObPlanCacheManager::revert_plan_cache(const uint64_t &tenant_id)
|
||||
|
||||
void ObPlanCacheManager::ObPlanCacheEliminationTask::runTimerTask()
|
||||
{
|
||||
#define NEED_AUTO_FLUSH_PC(v) (0 == v ? false : true)
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_ISNULL(plan_cache_manager_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
SQL_PC_LOG(WARN, "plan_cache_manager not inited", K(ret));
|
||||
} else {
|
||||
++run_task_counter_;
|
||||
const int64_t auto_flush_pc_interval = (int64_t)(GCONF._ob_plan_cache_auto_flush_interval) / (1000 * 1000L); // second
|
||||
{
|
||||
// 在调用plan cache接口前引用plan资源前必须定义guard
|
||||
observer::ObReqTimeGuard req_timeinfo_guard;
|
||||
|
||||
run_plan_cache_task();
|
||||
run_ps_cache_task();
|
||||
if (NEED_AUTO_FLUSH_PC(auto_flush_pc_interval)
|
||||
&& 0 == run_task_counter_ % auto_flush_pc_interval) {
|
||||
run_auto_flush_plan_cache_task();
|
||||
}
|
||||
SQL_PC_LOG(INFO, "schedule next cache evict task",
|
||||
"evict_interval", (int64_t)(GCONF.plan_cache_evict_interval));
|
||||
}
|
||||
@ -313,15 +306,6 @@ void ObPlanCacheManager::ObPlanCacheEliminationTask::runTimerTask()
|
||||
}
|
||||
}
|
||||
|
||||
void ObPlanCacheManager::ObPlanCacheEliminationTask::run_auto_flush_plan_cache_task()
|
||||
{
|
||||
if (OB_ISNULL(plan_cache_manager_)) {
|
||||
// do nothing
|
||||
} else {
|
||||
IGNORE_RETURN plan_cache_manager_->flush_all_plan_cache();
|
||||
}
|
||||
}
|
||||
|
||||
void ObPlanCacheManager::ObPlanCacheEliminationTask::run_plan_cache_task()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
||||
@ -47,7 +47,6 @@ public:
|
||||
void run_plan_cache_task();
|
||||
void run_ps_cache_task();
|
||||
void run_free_cache_obj_task();
|
||||
void run_auto_flush_plan_cache_task();
|
||||
public:
|
||||
ObPlanCacheManager *plan_cache_manager_;
|
||||
int64_t run_task_counter_;
|
||||
|
||||
@ -144,7 +144,6 @@ int ObPlanSet::match_params_info(const ParamStore *params,
|
||||
} else if (fetch_cur_time_ && FALSE_IT(plan_ctx->set_cur_time(
|
||||
ObClockGenerator::getClock(), *session))) {
|
||||
// never reach
|
||||
} else if (FALSE_IT(plan_ctx->set_last_trace_id(session->get_last_trace_id()))) {
|
||||
} else if (params->count() != params_info_.count()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("param info count is different", K(params_info_), K(*params), K(ret));
|
||||
@ -491,7 +490,7 @@ int ObPlanSet::match_params_info(const Ob2DArray<ObParamInfo,
|
||||
}
|
||||
}
|
||||
|
||||
if (is_sql_planset() && OB_SUCC(ret) && is_same) {
|
||||
if (OB_SUCC(ret) && is_same) {
|
||||
CK( OB_NOT_NULL(pc_ctx.exec_ctx_.get_physical_plan_ctx()) );
|
||||
if (OB_SUCC(ret)) {
|
||||
const ParamStore ¶ms = pc_ctx.exec_ctx_.get_physical_plan_ctx()->get_param_store();
|
||||
@ -739,8 +738,6 @@ int ObPlanSet::set_equal_param_constraint(common::ObIArray<ObPCParamEqualInfo> &
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < equal_param_constraint.count(); ++i) {
|
||||
ObPCParamEqualInfo &equal_info = equal_param_constraint.at(i);
|
||||
if (equal_info.first_param_idx_ < 0 || equal_info.second_param_idx_ < 0 ||
|
||||
equal_info.first_param_idx_ > params_info_.count() ||
|
||||
equal_info.second_param_idx_ > params_info_.count() ||
|
||||
equal_info.first_param_idx_ == equal_info.second_param_idx_) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("get invalid equal param constraint", K(ret), K(equal_info));
|
||||
|
||||
@ -289,6 +289,7 @@ ObPsStmtInfo::ObPsStmtInfo(ObIAllocator *inner_allocator)
|
||||
is_expired_evicted_(false),
|
||||
allocator_(inner_allocator),
|
||||
external_allocator_(inner_allocator),
|
||||
is_dynamic_sql_(false),
|
||||
num_of_returning_into_(-1),
|
||||
no_param_sql_(),
|
||||
is_sensitive_sql_(false),
|
||||
@ -318,6 +319,7 @@ ObPsStmtInfo::ObPsStmtInfo(ObIAllocator *inner_allocator,
|
||||
is_expired_evicted_(false),
|
||||
allocator_(inner_allocator),
|
||||
external_allocator_(external_allocator),
|
||||
is_dynamic_sql_(false),
|
||||
num_of_returning_into_(-1),
|
||||
no_param_sql_(),
|
||||
is_sensitive_sql_(false),
|
||||
@ -448,6 +450,7 @@ int ObPsStmtInfo::deep_copy(const ObPsStmtInfo &other)
|
||||
ps_stmt_checksum_ = other.ps_stmt_checksum_;
|
||||
db_id_ = other.db_id_;
|
||||
question_mark_count_ = other.question_mark_count_;
|
||||
is_dynamic_sql_ = other.is_dynamic_sql_;
|
||||
num_of_returning_into_ = other.num_of_returning_into_;
|
||||
is_sensitive_sql_ = other.is_sensitive_sql_;
|
||||
can_direct_use_param_ = other.can_direct_use_param();
|
||||
|
||||
@ -160,7 +160,8 @@ public:
|
||||
inline void set_can_direct_use_param(bool v) { can_direct_use_param_ = v; }
|
||||
inline void set_ps_stmt_checksum(uint64_t ps_checksum) { ps_stmt_checksum_ = ps_checksum; }
|
||||
inline uint64_t get_ps_stmt_checksum() const { return ps_stmt_checksum_; }
|
||||
|
||||
inline void set_is_dynamic_sql(const bool is_dynamic_sql) { is_dynamic_sql_ = is_dynamic_sql; }
|
||||
inline bool get_is_dynamic_sql() const { return is_dynamic_sql_; }
|
||||
inline void set_num_of_returning_into(int32_t num_of_returning_into)
|
||||
{ num_of_returning_into_ = num_of_returning_into; }
|
||||
inline int32_t get_num_of_returning_into() const { return num_of_returning_into_; }
|
||||
@ -245,6 +246,7 @@ private:
|
||||
common::ObIAllocator *allocator_;
|
||||
//指向ObPsPlancache中的inner_allocator_, 用于释放整个ObPsStmtItem的内存
|
||||
common::ObIAllocator *external_allocator_;
|
||||
bool is_dynamic_sql_;
|
||||
int32_t num_of_returning_into_;
|
||||
common::ObString no_param_sql_;
|
||||
bool is_sensitive_sql_;
|
||||
|
||||
@ -559,6 +559,9 @@ int ObPsCache::fill_ps_stmt_info(const ObResultSet &result,
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
int64_t info_size = 0;
|
||||
if (!sql_ctx->is_dbms_sql_) {
|
||||
ps_stmt_info.set_is_dynamic_sql(sql_ctx->is_dynamic_sql_);
|
||||
}
|
||||
if (OB_FAIL(ps_stmt_info.get_convert_size(info_size))) {
|
||||
LOG_WARN("fail to get convert size", K(ret));
|
||||
} else {
|
||||
|
||||
@ -784,7 +784,7 @@ int ObSqlParameterization::check_and_generate_param_info(const ObIArray<ObPCPara
|
||||
// do nothing
|
||||
}
|
||||
else {
|
||||
ret = OB_NOT_SUPPORTED;
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SQL_PC_LOG(ERROR, "const number of fast parse and normal parse is different",
|
||||
"fast_parse_const_num", raw_params.count(),
|
||||
"normal_parse_const_num", sql_info.total_);
|
||||
|
||||
Reference in New Issue
Block a user