timeguard and tenant config opt (5/5)

This commit is contained in:
obdev
2023-03-02 18:49:10 +00:00
committed by ob-robot
parent b382879cb3
commit a65db0d0f8
19 changed files with 94 additions and 122 deletions

View File

@ -4009,11 +4009,10 @@ int ObSql::pc_add_plan(ObPlanCacheCtx &pc_ctx,
pc_ctx.fp_result_.pc_key_.namespace_ = ObLibCacheNameSpace::NS_CRSR;
plan_added = false;
bool is_batch_exec = pc_ctx.sql_ctx_.multi_stmt_item_.is_batched_multi_stmt();
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(MTL_ID()));
if (OB_ISNULL(phy_plan) || OB_ISNULL(plan_cache)) {
ret = OB_NOT_INIT;
LOG_WARN("Fail to generate plan", K(phy_plan), K(plan_cache));
} else if (!tenant_config.is_valid()) {
} else if (OB_ISNULL(pc_ctx.sql_ctx_.session_info_)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("tenant config is invalid", K(ret));
} else if (OB_USE_PLAN_CACHE_NONE == phy_plan->get_phy_plan_hint().plan_cache_policy_) {
@ -4038,7 +4037,7 @@ int ObSql::pc_add_plan(ObPlanCacheCtx &pc_ctx,
phy_plan->stat_.db_id_ = pc_ctx.sql_ctx_.spm_ctx_.bl_key_.db_id_;
phy_plan->stat_.is_rewrite_sql_ = pc_ctx.is_rewrite_sql_;
phy_plan->stat_.rule_version_ = rule_mgr->get_rule_version();
phy_plan->stat_.enable_udr_ = tenant_config->enable_user_defined_rewrite_rules;
phy_plan->stat_.enable_udr_ = pc_ctx.sql_ctx_.session_info_->enable_user_defined_rewrite_rules();
if (PC_PS_MODE == pc_ctx.mode_ || PC_PL_MODE == pc_ctx.mode_) {
//远程SQL第二次进入plan,将raw_sql作为pc_key存入plan cache中,