Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大炮V587
oceanbase
提交
2303f8e5
O
oceanbase
项目概览
大炮V587
/
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,发现更多精彩内容 >>
提交
2303f8e5
编写于
8月 30, 2021
作者:
R
raywill
提交者:
wangzelin.wzl
8月 30, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix table location memory leak
上级
e8e87dfc
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
51 addition
and
17 deletion
+51
-17
src/sql/engine/px/ob_px_util.cpp
src/sql/engine/px/ob_px_util.cpp
+8
-2
src/sql/executor/ob_task_executor_ctx.cpp
src/sql/executor/ob_task_executor_ctx.cpp
+6
-13
src/sql/executor/ob_task_executor_ctx.h
src/sql/executor/ob_task_executor_ctx.h
+2
-2
src/sql/ob_phy_table_location.h
src/sql/ob_phy_table_location.h
+35
-0
未找到文件。
src/sql/engine/px/ob_px_util.cpp
浏览文件 @
2303f8e5
...
...
@@ -91,6 +91,7 @@ int ObPXServerAddrUtil::alloc_by_data_distribution_inner(ObExecContext& ctx, ObD
}
}
else
{
const
ObPhyTableLocation
*
table_loc
=
NULL
;
ObPhyTableLocationGuard
full_table_loc
;
uint64_t
table_location_key
=
OB_INVALID_INDEX
;
uint64_t
ref_table_id
=
OB_INVALID_ID
;
if
(
scan_ops
.
count
()
>
0
)
{
...
...
@@ -106,8 +107,10 @@ int ObPXServerAddrUtil::alloc_by_data_distribution_inner(ObExecContext& ctx, ObD
if
(
dml_op
&&
dml_op
->
is_table_location_uncertain
())
{
bool
is_weak
=
false
;
if
(
OB_FAIL
(
ObTaskExecutorCtxUtil
::
get_full_table_phy_table_location
(
ctx
,
table_location_key
,
ref_table_id
,
is_weak
,
table_loc
)))
{
ctx
,
table_location_key
,
ref_table_id
,
is_weak
,
full_
table_loc
)))
{
LOG_WARN
(
"fail to get phy table location"
,
K
(
ret
));
}
else
{
table_loc
=
full_table_loc
.
get_loc
();
}
}
else
{
if
(
OB_FAIL
(
ObTaskExecutorCtxUtil
::
get_phy_table_location
(
ctx
,
table_location_key
,
ref_table_id
,
table_loc
)))
{
...
...
@@ -504,6 +507,7 @@ int ObPXServerAddrUtil::set_dfo_accessed_location(
// pass
}
else
{
const
ObPhyTableLocation
*
table_loc
=
nullptr
;
ObPhyTableLocationGuard
full_table_loc
;
uint64_t
table_location_key
=
common
::
OB_INVALID_ID
;
uint64_t
ref_table_id
=
common
::
OB_INVALID_ID
;
if
(
FALSE_IT
(
table_location_key
=
dml_op
->
get_table_id
()))
{
...
...
@@ -512,8 +516,10 @@ int ObPXServerAddrUtil::set_dfo_accessed_location(
if
(
dml_op
->
is_table_location_uncertain
())
{
bool
is_weak
=
false
;
if
(
OB_FAIL
(
ObTaskExecutorCtxUtil
::
get_full_table_phy_table_location
(
ctx
,
table_location_key
,
ref_table_id
,
is_weak
,
table_loc
)))
{
ctx
,
table_location_key
,
ref_table_id
,
is_weak
,
full_
table_loc
)))
{
LOG_WARN
(
"fail to get phy table location"
,
K
(
ret
));
}
else
{
table_loc
=
full_table_loc
.
get_loc
();
}
}
else
{
if
(
OB_FAIL
(
ObTaskExecutorCtxUtil
::
get_phy_table_location
(
ctx
,
table_location_key
,
ref_table_id
,
table_loc
)))
{
...
...
src/sql/executor/ob_task_executor_ctx.cpp
浏览文件 @
2303f8e5
...
...
@@ -335,8 +335,9 @@ int ObTaskExecutorCtxUtil::get_part_runner_server(
return
ret
;
}
int
ObTaskExecutorCtxUtil
::
get_full_table_phy_table_location
(
ObExecContext
&
ctx
,
uint64_t
table_location_key
,
uint64_t
ref_table_id
,
bool
is_weak
,
const
ObPhyTableLocation
*&
table_location
)
// 每次调用都会 allocate 一个 table_location
int
ObTaskExecutorCtxUtil
::
get_full_table_phy_table_location
(
ObExecContext
&
ctx
,
uint64_t
table_location_key
,
uint64_t
ref_table_id
,
bool
is_weak
,
ObPhyTableLocationGuard
&
table_location
)
{
int
ret
=
OB_SUCCESS
;
ObPhyTableLocationInfo
phy_location_info
;
...
...
@@ -348,9 +349,6 @@ int ObTaskExecutorCtxUtil::get_full_table_phy_table_location(ObExecContext& ctx,
const
ObTableSchema
*
table_schema
=
NULL
;
const
uint64_t
tenant_id
=
extract_tenant_id
(
ref_table_id
);
// ObPhysicalPlanCtx *plan_ctx = ctx.get_physical_plan_ctx();
ObPhyTableLocation
*
loc
=
nullptr
;
table_location
=
NULL
;
if
(
OB_ISNULL
(
location_cache
)
||
OB_ISNULL
(
schema_service
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"location cache or schema_service is null"
,
KP
(
location_cache
),
KP
(
schema_service
),
K
(
ret
));
...
...
@@ -380,18 +378,13 @@ int ObTaskExecutorCtxUtil::get_full_table_phy_table_location(ObExecContext& ctx,
if
(
OB_FAIL
(
ret
))
{
// bypass
}
else
if
(
NULL
==
(
loc
=
static_cast
<
ObPhyTableLocation
*>
(
ctx
.
get_allocator
().
alloc
(
sizeof
(
ObPhyTableLocation
)))))
{
ret
=
OB_ALLOCATE_MEMORY_FAILED
;
}
else
if
(
NULL
==
(
loc
=
new
(
loc
)
ObPhyTableLocation
()))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"fail new object"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
ObTableLocation
::
get_phy_table_location_info
(
ctx
,
table_location_key
,
ref_table_id
,
is_weak
,
part_ids
,
*
location_cache
,
phy_location_info
)))
{
LOG_WARN
(
"get phy table location info failed"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
loc
->
add_partition_locations
(
phy_location_info
)))
{
}
else
if
(
OB_FAIL
(
table_location
.
new_location
(
ctx
.
get_allocator
())))
{
LOG_WARN
(
"fail alloc new location"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
table_location
.
get_loc
()
->
add_partition_locations
(
phy_location_info
)))
{
LOG_WARN
(
"add partition locations failed"
,
K
(
ret
),
K
(
phy_location_info
));
}
else
{
table_location
=
loc
;
}
return
ret
;
}
...
...
src/sql/executor/ob_task_executor_ctx.h
浏览文件 @
2303f8e5
...
...
@@ -310,8 +310,8 @@ public:
ObTaskExecutorCtx
&
ctx
,
uint64_t
table_location_key
,
uint64_t
ref_table_id
,
ObPhyTableLocation
*&
table_location
);
static
ObPhyTableLocation
*
get_phy_table_location_for_update
(
ObTaskExecutorCtx
&
ctx
,
uint64_t
table_location_key
,
uint64_t
ref_table_id
);
static
int
get_full_table_phy_table_location
(
ObExecContext
&
ctx
,
uint64_t
table_location_key
,
uint64_t
ref_table_id
,
bool
is_weak
,
const
ObPhyTableLocation
*&
table_location
);
static
int
get_full_table_phy_table_location
(
ObExecContext
&
ctx
,
uint64_t
table_location_key
,
uint64_t
ref_table_id
,
bool
is_weak
,
ObPhyTableLocationGuard
&
table_location
);
static
int
extract_server_participants
(
ObExecContext
&
ctx
,
const
common
::
ObAddr
&
svr
,
common
::
ObPartitionIArray
&
participants
);
...
...
src/sql/ob_phy_table_location.h
浏览文件 @
2303f8e5
...
...
@@ -185,6 +185,41 @@ int ObPhyTableLocation::find_not_include_part_ids(const SrcArray& all_part_ids,
}
return
ret
;
}
class
ObPhyTableLocationGuard
{
public:
ObPhyTableLocationGuard
()
:
loc_
(
nullptr
){};
~
ObPhyTableLocationGuard
()
{
if
(
loc_
)
{
loc_
->~
ObPhyTableLocation
();
loc_
=
nullptr
;
}
}
int
new_location
(
common
::
ObIAllocator
&
allocator
)
{
int
ret
=
common
::
OB_SUCCESS
;
void
*
buf
=
nullptr
;
if
(
OB_NOT_NULL
(
loc_
))
{
// init twice
ret
=
common
::
OB_ERR_UNEXPECTED
;
}
else
if
(
nullptr
==
(
buf
=
allocator
.
alloc
(
sizeof
(
ObPhyTableLocation
))))
{
ret
=
common
::
OB_ALLOCATE_MEMORY_FAILED
;
}
else
if
(
NULL
==
(
loc_
=
new
(
buf
)
ObPhyTableLocation
()))
{
ret
=
common
::
OB_ERR_UNEXPECTED
;
}
return
ret
;
}
// caller must ensure that the loc_ is not NULL before call get_loc()
ObPhyTableLocation
*
get_loc
()
{
return
loc_
;
}
private:
ObPhyTableLocation
*
loc_
;
};
}
// namespace sql
}
// namespace oceanbase
#endif
/* OCEANBASE_SQL_OB_PHY_TABLE_LOCATION_ */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录