Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
a3fa322b
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,发现更多精彩内容 >>
提交
a3fa322b
编写于
2月 16, 2022
作者:
Y
yb0
提交者:
LINGuanRen
2月 16, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify large stack variable to heap variable for pwj compare
上级
b79cea0c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
46 addition
and
42 deletion
+46
-42
src/sql/plan_cache/ob_dist_plans.cpp
src/sql/plan_cache/ob_dist_plans.cpp
+46
-42
未找到文件。
src/sql/plan_cache/ob_dist_plans.cpp
浏览文件 @
a3fa322b
...
...
@@ -593,51 +593,55 @@ int ObDistPlans::check_inner_constraints(const ObIArray<ObPlanPwjConstraint>& st
if
(
strict_cons
.
count
()
>
0
||
non_strict_cons
.
count
()
>
0
)
{
const
int64_t
tbl_count
=
phy_tbl_infos
.
count
();
ObSEArray
<
PwjTable
,
8
>
pwj_tables
;
ObPwjComparer
strict_pwj_comparer
(
true
);
ObPwjComparer
non_strict_pwj_comparer
(
false
);
if
(
OB_FAIL
(
pwj_tables
.
prepare_allocate
(
tbl_count
)))
{
LOG_WARN
(
"failed to prepare allocate pwj tables"
,
K
(
ret
));
}
HEAP_VAR
(
ObPwjComparer
,
strict_pwj_comparer
,
true
)
{
HEAP_VAR
(
ObPwjComparer
,
non_strict_pwj_comparer
,
false
)
{
if
(
OB_FAIL
(
pwj_tables
.
prepare_allocate
(
tbl_count
)))
{
LOG_WARN
(
"failed to prepare allocate pwj tables"
,
K
(
ret
));
}
/* Traverse strict pwj constraints and non-strict pwj constraints, and generate a partition id
* mapping that can do partition wise join.
* Because there may be constraints in the following forms
* strict_pwj_cons = [0,1], [2,3]
* non_strict_pwj_cons = [0,2]
* If you traverse strict_pwj_cons first, and then traverse non_strict_pwj_cons, there may be a situation:
* After traversing strict_pwj_cons, the mapping of [part_array0, part_array1, part_array2, part_array3] is set in
* pwj_map, But when traversing non_strict_pwj_cons, it is found that partition_array2 needs to be adjusted, then
* all the arrays related to it must be adjusted recursively, The adjustment is very complicated. Traverse in
* strict_pwj_cons and non_strict_pwj_cons separately in the order of the base table to avoid this situation:
* Traverse all constraints starting with 0, and set the mapping of [part_array0, part_array1, part_array2] in
* pwj_map; Traverse all the constraints starting with 1, and find that there are no related constraints; To
* traverse all constraints starting with 2, you need to set part_array3 in pwj_map, because part_array2 has been
* set, so The mapping of part_array3 generated by part_array2 does not need to be adjusted Traverse all the
* constraints starting with 3 and find that there are no related constraints
*/
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
tbl_count
;
++
i
)
{
for
(
int64_t
j
=
0
;
OB_SUCC
(
ret
)
&&
j
<
strict_cons
.
count
();
++
j
)
{
const
ObPlanPwjConstraint
&
pwj_cons
=
strict_cons
.
at
(
j
);
if
(
OB_UNLIKELY
(
pwj_cons
.
count
()
<=
1
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"get unexpected pwj constraint"
,
K
(
ret
),
K
(
pwj_cons
));
}
else
if
(
pwj_cons
.
at
(
0
)
==
i
)
{
if
(
OB_FAIL
(
check_pwj_cons
(
pc_ctx
,
pwj_cons
,
phy_tbl_infos
,
pwj_tables
,
strict_pwj_comparer
,
pwj_map
,
is_same
)))
{
LOG_WARN
(
"failed to check pwj cons"
,
K
(
ret
));
/* Traverse strict pwj constraints and non-strict pwj constraints, and generate a partition id
* mapping that can do partition wise join.
* Because there may be constraints in the following forms
* strict_pwj_cons = [0,1], [2,3]
* non_strict_pwj_cons = [0,2]
* If you traverse strict_pwj_cons first, and then traverse non_strict_pwj_cons, there may be a situation:
* After traversing strict_pwj_cons, the mapping of [part_array0, part_array1, part_array2, part_array3] is set in
* pwj_map, But when traversing non_strict_pwj_cons, it is found that partition_array2 needs to be adjusted, then
* all the arrays related to it must be adjusted recursively, The adjustment is very complicated. Traverse in
* strict_pwj_cons and non_strict_pwj_cons separately in the order of the base table to avoid this situation:
* Traverse all constraints starting with 0, and set the mapping of [part_array0, part_array1, part_array2] in
* pwj_map; Traverse all the constraints starting with 1, and find that there are no related constraints; To
* traverse all constraints starting with 2, you need to set part_array3 in pwj_map, because part_array2 has been
* set, so The mapping of part_array3 generated by part_array2 does not need to be adjusted Traverse all the
* constraints starting with 3 and find that there are no related constraints
*/
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
tbl_count
;
++
i
)
{
for
(
int64_t
j
=
0
;
OB_SUCC
(
ret
)
&&
j
<
strict_cons
.
count
();
++
j
)
{
const
ObPlanPwjConstraint
&
pwj_cons
=
strict_cons
.
at
(
j
);
if
(
OB_UNLIKELY
(
pwj_cons
.
count
()
<=
1
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"get unexpected pwj constraint"
,
K
(
ret
),
K
(
pwj_cons
));
}
else
if
(
pwj_cons
.
at
(
0
)
==
i
)
{
if
(
OB_FAIL
(
check_pwj_cons
(
pc_ctx
,
pwj_cons
,
phy_tbl_infos
,
pwj_tables
,
strict_pwj_comparer
,
pwj_map
,
is_same
)))
{
LOG_WARN
(
"failed to check pwj cons"
,
K
(
ret
));
}
}
}
}
}
for
(
int64_t
j
=
0
;
OB_SUCC
(
ret
)
&&
j
<
non_strict_cons
.
count
();
++
j
)
{
const
ObPlanPwjConstraint
&
pwj_cons
=
non_strict_cons
.
at
(
j
);
if
(
OB_UNLIKELY
(
pwj_cons
.
count
()
<=
1
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"get unexpected pwj constraint"
,
K
(
ret
),
K
(
pwj_cons
));
}
else
if
(
pwj_cons
.
at
(
0
)
==
i
)
{
if
(
OB_FAIL
(
check_pwj_cons
(
pc_ctx
,
pwj_cons
,
phy_tbl_infos
,
pwj_tables
,
non_strict_pwj_comparer
,
pwj_map
,
is_same
)))
{
LOG_WARN
(
"failed to check pwj cons"
,
K
(
ret
));
for
(
int64_t
j
=
0
;
OB_SUCC
(
ret
)
&&
j
<
non_strict_cons
.
count
();
++
j
)
{
const
ObPlanPwjConstraint
&
pwj_cons
=
non_strict_cons
.
at
(
j
);
if
(
OB_UNLIKELY
(
pwj_cons
.
count
()
<=
1
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"get unexpected pwj constraint"
,
K
(
ret
),
K
(
pwj_cons
));
}
else
if
(
pwj_cons
.
at
(
0
)
==
i
)
{
if
(
OB_FAIL
(
check_pwj_cons
(
pc_ctx
,
pwj_cons
,
phy_tbl_infos
,
pwj_tables
,
non_strict_pwj_comparer
,
pwj_map
,
is_same
)))
{
LOG_WARN
(
"failed to check pwj cons"
,
K
(
ret
));
}
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录