fix memory leak when unit migrate or del tenant happens

This commit is contained in:
jh0
2021-07-27 15:39:13 +08:00
committed by wangzelin.wzl
parent 85d7d1e6f8
commit 9d77e24a32
8 changed files with 29 additions and 5 deletions

View File

@ -106,7 +106,9 @@ int ObCacheObjectFactory::alloc(
* then the atomicity of hashmap can ensure that only one thread does the removal action, and
* only this thread gets the CacheObject pointer to do subsequent destructuring
*/
if (OB_FAIL(plan_cache->get_deleted_map().set_refactored(cache_obj_id, cache_obj))) {
if (!plan_cache->is_valid()) {
// do nothing
} else if (OB_FAIL(plan_cache->get_deleted_map().set_refactored(cache_obj_id, cache_obj))) {
LOG_WARN("failed to add element to hashmap", K(ret));
inner_free(cache_obj);
cache_obj = NULL;