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