Repair plan cache mode error about spm.

This commit is contained in:
obdev
2023-01-28 19:23:32 +08:00
committed by ob-robot
parent c24c75ed20
commit 91f036ae7c
8 changed files with 22 additions and 19 deletions

View File

@ -55,7 +55,7 @@ struct ObPlanCacheKey : public ObILibCacheKey
: key_id_(common::OB_INVALID_ID),
db_id_(common::OB_INVALID_ID),
sessid_(0),
mode_(PC_INVALID_MODE) {}
mode_(PC_TEXT_MODE) {}
ObPlanCacheKey(const ObString &name,
uint64_t key_id,
uint64_t db_id,
@ -79,7 +79,7 @@ struct ObPlanCacheKey : public ObILibCacheKey
key_id_ = common::OB_INVALID_ID;
db_id_ = common::OB_INVALID_ID;
sessid_ = 0;
mode_ = PC_INVALID_MODE;
mode_ = PC_TEXT_MODE;
sys_vars_str_.reset();
config_str_.reset();
namespace_ = NS_INVALID;
@ -386,6 +386,7 @@ struct ObPlanCacheCtx : public ObILibCacheCtx
bool is_rewrite_sql() const { return is_rewrite_sql_; }
void set_need_retry_add_plan(bool v) { need_retry_add_plan_ = v; }
bool need_retry_add_plan() const { return need_retry_add_plan_; }
void set_pc_key_mode() { fp_result_.pc_key_.mode_ = mode_; }
TO_STRING_KV(
K(mode_),
K(raw_sql_),

View File

@ -972,6 +972,10 @@ int ObSqlParameterization::parameterize_syntax_tree(common::ObIAllocator &alloca
|| (is_prepare_mode(mode) && sql_info.ps_need_parameterized_));
}
if (OB_FAIL(ret)) {
} else if (OB_FAIL(get_related_user_vars(tree, user_var_names))) {
LOG_WARN("failed to get related session vars", K(ret));
} else if (OB_FAIL(pc_ctx.sql_ctx_.set_related_user_var_names(user_var_names, allocator))) {
LOG_WARN("failed to set related user var names for sql ctx", K(ret));
} else if (is_execute_mode(mode)) {
if (OB_FAIL(gen_ps_not_param_var(sql_info.ps_not_param_offsets_, params, pc_ctx))) {
SQL_PC_LOG(WARN, "fail to gen ps not param var", K(ret));
@ -991,10 +995,6 @@ int ObSqlParameterization::parameterize_syntax_tree(common::ObIAllocator &alloca
}
} else if (OB_FAIL(gen_special_param_info(sql_info, pc_ctx))) {
SQL_PC_LOG(WARN, "fail to gen special param info", K(ret));
} else if (OB_FAIL(get_related_user_vars(tree, user_var_names))) {
LOG_WARN("failed to get related session vars", K(ret));
} else if (OB_FAIL(pc_ctx.sql_ctx_.set_related_user_var_names(user_var_names, allocator))) {
LOG_WARN("failed to set related user var names for sql ctx", K(ret));
} else {
// do nothing
}