Fix incorrect plan sharing causing crash

This commit is contained in:
obdev
2024-02-08 20:53:20 +00:00
committed by ob-robot
parent 0581e5049c
commit 77025bbbb3
3 changed files with 20 additions and 7 deletions

View File

@ -2312,6 +2312,7 @@ OB_INLINE int ObPlanCache::construct_plan_cache_key(ObSQLSessionInfo &session,
pc_key.namespace_ = ns;
pc_key.sys_vars_str_ = session.get_sys_var_in_pc_str();
pc_key.config_str_ = session.get_config_in_pc_str();
pc_key.use_rich_vector_format_ = session.use_rich_format();
pc_key.is_weak_read_ = is_weak;
return ret;
}

View File

@ -56,7 +56,7 @@ struct ObPlanCacheKey : public ObILibCacheKey
db_id_(common::OB_INVALID_ID),
sessid_(0),
mode_(PC_TEXT_MODE),
is_weak_read_(false) {}
flag_(0) {}
inline void reset()
{
@ -67,7 +67,7 @@ struct ObPlanCacheKey : public ObILibCacheKey
mode_ = PC_TEXT_MODE;
sys_vars_str_.reset();
config_str_.reset();
is_weak_read_ = false;
flag_ = 0;
namespace_ = NS_INVALID;
}
@ -92,7 +92,7 @@ struct ObPlanCacheKey : public ObILibCacheKey
sessid_ = pc_key.sessid_;
mode_ = pc_key.mode_;
namespace_ = pc_key.namespace_;
is_weak_read_ = pc_key.is_weak_read_;
flag_ = pc_key.flag_;
}
return ret;
}
@ -116,6 +116,7 @@ struct ObPlanCacheKey : public ObILibCacheKey
hash_ret = common::murmurhash(&db_id_, sizeof(uint64_t), hash_ret);
hash_ret = common::murmurhash(&sessid_, sizeof(uint32_t), hash_ret);
hash_ret = common::murmurhash(&mode_, sizeof(PlanCacheMode), hash_ret);
hash_ret = common::murmurhash(&flag_, sizeof(flag_), hash_ret);
hash_ret = sys_vars_str_.hash(hash_ret);
hash_ret = config_str_.hash(hash_ret);
hash_ret = common::murmurhash(&namespace_, sizeof(ObLibCacheNameSpace), hash_ret);
@ -133,7 +134,7 @@ struct ObPlanCacheKey : public ObILibCacheKey
mode_ == pc_key.mode_ &&
sys_vars_str_ == pc_key.sys_vars_str_ &&
config_str_ == pc_key.config_str_ &&
is_weak_read_ == pc_key.is_weak_read_ &&
flag_ == pc_key.flag_ &&
namespace_ == pc_key.namespace_;
return cmp_ret;
@ -145,7 +146,7 @@ struct ObPlanCacheKey : public ObILibCacheKey
K_(mode),
K_(sys_vars_str),
K_(config_str),
K_(is_weak_read),
K_(flag),
K_(namespace));
//通过name来进行查找,一般是shared sql/procedure
//cursor用这种方式,对应的namespace是CRSR
@ -158,7 +159,16 @@ struct ObPlanCacheKey : public ObILibCacheKey
PlanCacheMode mode_;
common::ObString sys_vars_str_;
common::ObString config_str_;
bool is_weak_read_;
union
{
uint16_t flag_;
struct
{
uint16_t is_weak_read_ : 1;
uint16_t use_rich_vector_format_ : 1;
uint16_t reserved_ : 14; // reserved
};
};
};
//记录快速化参数后不需要扣参数的原始字符串及相关信息