Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
3b34a4d6
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3b34a4d6
编写于
1月 26, 2017
作者:
S
Shreedhar Hardikar
提交者:
Shreedhar Hardikar
1月 30, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add ICG tests for motion hazard deadlock case.
上级
51bb35a2
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
105 addition
and
0 deletion
+105
-0
src/backend/cdb/cdbllize.c
src/backend/cdb/cdbllize.c
+2
-0
src/backend/executor/nodeHashjoin.c
src/backend/executor/nodeHashjoin.c
+2
-0
src/backend/executor/nodeMaterial.c
src/backend/executor/nodeMaterial.c
+2
-0
src/backend/executor/nodeMergejoin.c
src/backend/executor/nodeMergejoin.c
+2
-0
src/backend/executor/nodeMotion.c
src/backend/executor/nodeMotion.c
+1
-0
src/backend/executor/nodeNestloop.c
src/backend/executor/nodeNestloop.c
+2
-0
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/createplan.c
+2
-0
src/test/regress/expected/deadlock.out
src/test/regress/expected/deadlock.out
+46
-0
src/test/regress/greenplum_schedule
src/test/regress/greenplum_schedule
+3
-0
src/test/regress/sql/deadlock.sql
src/test/regress/sql/deadlock.sql
+43
-0
未找到文件。
src/backend/cdb/cdbllize.c
浏览文件 @
3b34a4d6
...
...
@@ -1396,6 +1396,8 @@ motion_sanity_walker(Node *node, sanity_result_t *result)
* We avoid this by pre-fetching all the inner tuples in such cases and
* materializing them in some fashion, before moving on to outer_tuples.
* This effectively breaks the cycle and prevents deadlock.
*
* Details: https://groups.google.com/a/greenplum.org/forum/#!msg/gpdb-dev/gMa1tW0x_fk/wuzvGXBaBAAJ
*/
switch
(
nodeTag
(
node
))
{
...
...
src/backend/executor/nodeHashjoin.c
浏览文件 @
3b34a4d6
...
...
@@ -109,6 +109,8 @@ ExecHashJoin(HashJoinState *node)
*
* So now prefetch_inner is set (see createplan.c) if we have *any* motion
* below us. If we don't have any motion, it doesn't matter.
*
* See motion_sanity_walker() for details on how a deadlock may occur.
*/
if
(
!
node
->
prefetch_inner
)
{
...
...
src/backend/executor/nodeMaterial.c
浏览文件 @
3b34a4d6
...
...
@@ -126,6 +126,8 @@ ExecMaterial(MaterialState *node)
* and sending Motion operators to neutralize a deadlock hazard.
* MPP TODO: Remove when a better solution is implemented.
*
* See motion_sanity_walker() for details on how a deadlock may occur.
*
* ShareInput: if the material node
* is used to share input, we will need to fetch all rows and put
* them in tuple store
...
...
src/backend/executor/nodeMergejoin.c
浏览文件 @
3b34a4d6
...
...
@@ -661,6 +661,8 @@ ExecMergeJoin(MergeJoinState *node)
*
* So now prefetch_inner is set (see createplan.c) if we have *any* motion
* below us. If we don't have any motion, it doesn't matter.
*
* See motion_sanity_walker() for details on how a deadlock may occur.
*/
if
(
node
->
prefetch_inner
)
{
...
...
src/backend/executor/nodeMotion.c
浏览文件 @
3b34a4d6
...
...
@@ -234,6 +234,7 @@ ExecMotion(MotionState * node)
{
if
(
node
->
ps
.
state
->
active_recv_id
!=
motion
->
motionID
)
{
/* See motion_sanity_walker() for details on how a deadlock may occur. */
elog
(
LOG
,
"DEADLOCK HAZARD: Updating active_motion_id from %d to %d"
,
node
->
ps
.
state
->
active_recv_id
,
motion
->
motionID
);
node
->
ps
.
state
->
active_recv_id
=
motion
->
motionID
;
...
...
src/backend/executor/nodeNestloop.c
浏览文件 @
3b34a4d6
...
...
@@ -112,6 +112,8 @@ ExecNestLoop(NestLoopState *node)
*
* So now prefetch_inner is set (see createplan.c) if we have *any* motion
* below us. If we don't have any motion, it doesn't matter.
*
* See motion_sanity_walker() for details on how a deadlock may occur.
*/
if
(
node
->
prefetch_inner
)
{
...
...
src/backend/optimizer/plan/createplan.c
浏览文件 @
3b34a4d6
...
...
@@ -2980,6 +2980,8 @@ create_mergejoin_plan(PlannerInfo *root,
* We need some kind of strict slackening operator (something which consumes all of its
* input before producing a row of output) for our inner. And we need to prefetch that side
* first.
*
* See motion_sanity_walker() for details on how a deadlock may occur.
*/
if
(
best_path
->
jpath
.
outerjoinpath
->
motionHazard
&&
best_path
->
jpath
.
innerjoinpath
->
motionHazard
)
{
...
...
src/test/regress/expected/deadlock.out
0 → 100644
浏览文件 @
3b34a4d6
--
-- Test queries that can lead to deadlock. This is in a different file to
-- isolate the test & quickly identify it if ICG doesn't complete for a very
-- long time.
--
create schema deadlock;
set search_path = deadlock;
-- Test "Motion deadlock hazard" when Joins have Motions in both branches.
-- see src/backend/cdb/cdbllize.c
create table l (i int, j int) distributed by (i);
create table r (i int, j int) distributed by (j);
insert into l select i, 2 from generate_series(1, 100000) i; -- one segment destination
insert into r select i, 1 from generate_series(1, 100000) i; -- one segment destination
set enable_mergejoin = off;
set enable_hashjoin = on;
set enable_nestloop = off;
-- Pick HJ
select count(*) from gp_dist_random('l') left join gp_dist_random('r') on l.j + 1 = r.j;
count
--------
100000
(1 row)
set enable_mergejoin = off;
set enable_hashjoin = off;
set enable_nestloop = on;
-- Pick NLJ, gp_dist_random() forces MJ
select count(*) from l left join r on l.j + 1 = r.j;
count
--------
100000
(1 row)
set enable_mergejoin = on;
set enable_hashjoin = off;
set enable_nestloop = off;
-- Pick MJ
select count(*) from gp_dist_random('l') left outer join gp_dist_random('r') on l.j + 1 = r.j;
count
--------
100000
(1 row)
drop schema if exists deadlock cascade;
NOTICE: drop cascades to table r
NOTICE: drop cascades to table l
src/test/regress/greenplum_schedule
浏览文件 @
3b34a4d6
...
...
@@ -29,6 +29,9 @@ test: indexjoin as_alias regex_gp gpparams with_clause transient_types gp_rules
# dispatch should always run seperately from other cases.
test: dispatch
# deadlock tests run separately - because we don't know which one gets stuck.
test: deadlock
# This test will change the gp_workfile_limit_per_segment and will need to restart the DB.
# It will also use faultinjector - so it needs to be in a group by itself.
test: segspace_setup
...
...
src/test/regress/sql/deadlock.sql
0 → 100644
浏览文件 @
3b34a4d6
--
-- Test queries that can lead to deadlock. This is in a different file to
-- isolate the test & quickly identify it if ICG doesn't complete for a very
-- long time.
--
create
schema
deadlock
;
set
search_path
=
deadlock
;
-- Test "Motion deadlock hazard" when Joins have Motions in both branches.
-- see src/backend/cdb/cdbllize.c
create
table
l
(
i
int
,
j
int
)
distributed
by
(
i
);
create
table
r
(
i
int
,
j
int
)
distributed
by
(
j
);
insert
into
l
select
i
,
2
from
generate_series
(
1
,
100000
)
i
;
-- one segment destination
insert
into
r
select
i
,
1
from
generate_series
(
1
,
100000
)
i
;
-- one segment destination
set
enable_mergejoin
=
off
;
set
enable_hashjoin
=
on
;
set
enable_nestloop
=
off
;
-- Pick HJ
select
count
(
*
)
from
gp_dist_random
(
'l'
)
left
join
gp_dist_random
(
'r'
)
on
l
.
j
+
1
=
r
.
j
;
set
enable_mergejoin
=
off
;
set
enable_hashjoin
=
off
;
set
enable_nestloop
=
on
;
-- Pick NLJ, gp_dist_random() forces MJ
select
count
(
*
)
from
l
left
join
r
on
l
.
j
+
1
=
r
.
j
;
set
enable_mergejoin
=
on
;
set
enable_hashjoin
=
off
;
set
enable_nestloop
=
off
;
-- Pick MJ
select
count
(
*
)
from
gp_dist_random
(
'l'
)
left
outer
join
gp_dist_random
(
'r'
)
on
l
.
j
+
1
=
r
.
j
;
drop
schema
if
exists
deadlock
cascade
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录