Fix ps cache initialization is not thread-safe
This commit is contained in:
@ -90,16 +90,17 @@ int ObPsCache::init(const int64_t hash_bucket,
|
|||||||
const uint64_t tenant_id)
|
const uint64_t tenant_id)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
ObMemAttr attr;
|
lib::ObMutexGuard guard(mutex_);
|
||||||
attr.label_ = ObModIds::OB_SQL_PS_CACHE;
|
if (!inited_) {
|
||||||
attr.tenant_id_ = tenant_id;
|
ObMemAttr attr;
|
||||||
attr.ctx_id_ = ObCtxIds::PS_CACHE_CTX_ID;
|
attr.label_ = ObModIds::OB_SQL_PS_CACHE;
|
||||||
lib::ContextParam param;
|
attr.tenant_id_ = tenant_id;
|
||||||
param.set_properties(lib::ALLOC_THREAD_SAFE |
|
attr.ctx_id_ = ObCtxIds::PS_CACHE_CTX_ID;
|
||||||
lib::RETURN_MALLOC_DEFAULT)
|
lib::ContextParam param;
|
||||||
|
param.set_properties(lib::ALLOC_THREAD_SAFE |
|
||||||
|
lib::RETURN_MALLOC_DEFAULT)
|
||||||
.set_parallel(4)
|
.set_parallel(4)
|
||||||
.set_mem_attr(attr);
|
.set_mem_attr(attr);
|
||||||
if (!inited_) {
|
|
||||||
if (OB_FAIL(stmt_id_map_.create(hash::cal_next_prime(hash_bucket),
|
if (OB_FAIL(stmt_id_map_.create(hash::cal_next_prime(hash_bucket),
|
||||||
ObModIds::OB_HASH_BUCKET_PS_CACHE,
|
ObModIds::OB_HASH_BUCKET_PS_CACHE,
|
||||||
ObModIds::OB_HASH_NODE_PS_CACHE,
|
ObModIds::OB_HASH_NODE_PS_CACHE,
|
||||||
|
|||||||
Reference in New Issue
Block a user