Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
9d77e24a
O
oceanbase
项目概览
Metz
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9d77e24a
编写于
7月 27, 2021
作者:
J
jh0
提交者:
wangzelin.wzl
7月 27, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix memory leak when unit migrate or del tenant happens
上级
85d7d1e6
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
29 addition
and
5 deletion
+29
-5
src/observer/omt/ob_multi_tenant.cpp
src/observer/omt/ob_multi_tenant.cpp
+3
-0
src/observer/virtual_table/ob_all_plan_cache_stat.cpp
src/observer/virtual_table/ob_all_plan_cache_stat.cpp
+2
-0
src/sql/ob_sql.cpp
src/sql/ob_sql.cpp
+1
-1
src/sql/plan_cache/ob_cache_object_factory.cpp
src/sql/plan_cache/ob_cache_object_factory.cpp
+3
-1
src/sql/plan_cache/ob_plan_cache.cpp
src/sql/plan_cache/ob_plan_cache.cpp
+3
-1
src/sql/plan_cache/ob_plan_cache_manager.cpp
src/sql/plan_cache/ob_plan_cache_manager.cpp
+15
-1
src/sql/plan_cache/ob_plan_cache_manager.h
src/sql/plan_cache/ob_plan_cache_manager.h
+1
-0
src/sql/session/ob_sql_session_info.cpp
src/sql/session/ob_sql_session_info.cpp
+1
-1
未找到文件。
src/observer/omt/ob_multi_tenant.cpp
浏览文件 @
9d77e24a
...
...
@@ -415,6 +415,9 @@ int ObMultiTenant::add_tenant(const uint64_t tenant_id, const double min_cpu, co
OB_FAIL
(
OTC_MGR
.
got_version
(
tenant_id
,
common
::
ObSystemConfig
::
INIT_VERSION
)))
{
LOG_ERROR
(
"failed to got version"
,
K
(
tenant_id
),
K
(
ret
));
#endif
}
else
if
(
OB_FAIL
(
GCTX
.
sql_engine_
->
get_plan_cache_manager
()
->
validate_plan_cache
(
tenant_id
)))
{
// do nothing
LOG_WARN
(
"failed to active plan cache"
,
K
(
ret
),
K
(
tenant_id
));
}
else
{
LOG_INFO
(
"activate tenant done"
,
K
(
tenant_id
),
K
(
ret
));
}
...
...
src/observer/virtual_table/ob_all_plan_cache_stat.cpp
浏览文件 @
9d77e24a
...
...
@@ -334,6 +334,8 @@ int ObAllPlanCacheStat::get_row_from_tenants()
ObPlanCache
*
plan_cache
=
pcm_
->
get_plan_cache
(
tenant_id
);
if
(
OB_UNLIKELY
(
NULL
==
plan_cache
))
{
SERVER_LOG
(
WARN
,
"invalid plan cache"
,
K
(
ret
),
K
(
tenant_id
));
}
else
if
(
!
plan_cache
->
is_valid
())
{
// do nothing
}
else
{
if
(
OB_FAIL
(
fill_cells
(
*
plan_cache
)))
{
SERVER_LOG
(
WARN
,
"fail to fill cells"
,
K
(
ret
),
K
(
cur_row_
));
...
...
src/sql/ob_sql.cpp
浏览文件 @
9d77e24a
/**
/**
* Copyright (c) 2021 OceanBase
* OceanBase CE is licensed under Mulan PubL v2.
* You can use this software according to the terms and conditions of the Mulan PubL v2.
...
...
src/sql/plan_cache/ob_cache_object_factory.cpp
浏览文件 @
9d77e24a
...
...
@@ -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
;
...
...
src/sql/plan_cache/ob_plan_cache.cpp
浏览文件 @
9d77e24a
...
...
@@ -1080,7 +1080,9 @@ void ObPlanCache::dec_ref_count()
if
(
ref_count
>
0
)
{
}
else
if
(
0
==
ref_count
)
{
// delete
this
->~
ObPlanCache
();
this
->
set_valid
(
false
);
destroy
();
// this->~ObPlanCache();
}
else
if
(
ref_count
<
0
)
{
BACKTRACE
(
ERROR
,
true
,
"Plan Cache %p ref count < 0, ref_count = %ld"
,
this
,
ref_count
);
}
...
...
src/sql/plan_cache/ob_plan_cache_manager.cpp
浏览文件 @
9d77e24a
...
...
@@ -109,6 +109,20 @@ ObPsCache* ObPlanCacheManager::get_ps_cache(const uint64_t tenant_id)
return
ps_cache
;
}
int
ObPlanCacheManager
::
validate_plan_cache
(
const
uint64_t
&
tenant_id
)
{
int
ret
=
OB_SUCCESS
;
ObPlanCache
*
plan_cache
=
get_plan_cache
(
tenant_id
);
if
(
OB_ISNULL
(
plan_cache
))
{
// do nothing, and others will create this later.
}
else
{
plan_cache
->
set_valid
(
true
);
}
return
ret
;
}
// maybe get plan_cache = NULL;
// this thread other thread
//
...
...
@@ -251,7 +265,7 @@ int ObPlanCacheManager::revert_plan_cache(const uint64_t& tenant_id)
int
ret
=
OB_SUCCESS
;
ObPlanCache
*
ppc
=
NULL
;
observer
::
ObReqTimeGuard
req_timeinfo_guard
;
int
tmp_ret
=
pcm_
.
erase_refactored
(
tenant_id
,
&
ppc
);
int
tmp_ret
=
pcm_
.
get_refactored
(
tenant_id
,
ppc
);
if
(
OB_SUCCESS
==
tmp_ret
&&
NULL
!=
ppc
)
{
SQL_PC_LOG
(
INFO
,
"plan_cache_manager revert plan cache"
,
"pc ref_count"
,
ppc
->
get_ref_count
(),
K
(
tenant_id
));
// cancel scheduled task
...
...
src/sql/plan_cache/ob_plan_cache_manager.h
浏览文件 @
9d77e24a
...
...
@@ -82,6 +82,7 @@ public:
ObPlanCache
*
get_or_create_plan_cache
(
uint64_t
tenant_id
,
const
ObPCMemPctConf
&
pc_mem_conf
);
ObPsCache
*
get_or_create_ps_cache
(
const
uint64_t
tenant_id
,
const
ObPCMemPctConf
&
pc_mem_conf
);
int
validate_plan_cache
(
const
uint64_t
&
tenant_id
);
int
revert_plan_cache
(
const
uint64_t
&
tenant_id
);
int
revert_ps_cache
(
const
uint64_t
&
tenant_id
);
int
flush_all_plan_cache
();
...
...
src/sql/session/ob_sql_session_info.cpp
浏览文件 @
9d77e24a
...
...
@@ -611,7 +611,7 @@ void ObSQLSessionInfo::get_session_priv_info(share::schema::ObSessionPrivInfo& s
ObPlanCache
*
ObSQLSessionInfo
::
get_plan_cache
()
{
if
(
OB_LIKELY
(
NULL
!=
plan_cache_manager_
))
{
if
(
OB_NOT_NULL
(
plan_cache_
)
&&
plan_cache_
->
is_valid
()
)
{
if
(
OB_NOT_NULL
(
plan_cache_
))
{
// do nothing
}
else
{
// release old plancache and get new
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录