Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
bcc8fbd6
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,发现更多精彩内容 >>
提交
bcc8fbd6
编写于
6月 21, 2016
作者:
G
Gang Xiong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move slice related functions to execUtils.c
上级
49a50cfe
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
114 addition
and
97 deletion
+114
-97
src/backend/cdb/cdbexplain.c
src/backend/cdb/cdbexplain.c
+1
-1
src/backend/cdb/dispatcher/cdbgang.c
src/backend/cdb/dispatcher/cdbgang.c
+0
-79
src/backend/commands/explain.c
src/backend/commands/explain.c
+1
-1
src/backend/executor/execMain.c
src/backend/executor/execMain.c
+1
-1
src/backend/executor/execUtils.c
src/backend/executor/execUtils.c
+79
-1
src/include/cdb/cdbgang.h
src/include/cdb/cdbgang.h
+0
-14
src/include/executor/execUtils.h
src/include/executor/execUtils.h
+32
-0
未找到文件。
src/backend/cdb/cdbexplain.c
浏览文件 @
bcc8fbd6
...
...
@@ -15,6 +15,7 @@
#include "cdb/cdbexplain.h"
/* me */
#include "cdb/cdbpartition.h"
#include "cdb/cdbvars.h"
/* Gp_segment */
#include "executor/execUtils.h"
#include "executor/executor.h"
/* ExecStateTreeWalker */
#include "executor/instrument.h"
/* Instrumentation */
#include "lib/stringinfo.h"
/* StringInfo */
...
...
@@ -23,7 +24,6 @@
#include "libpq/pqformat.h"
/* pq_beginmessage() etc. */
#include "utils/memutils.h"
/* MemoryContextGetPeakSpace() */
#include "cdb/memquota.h"
#include "cdb/cdbgang.h"
#include "inttypes.h"
#include "utils/vmem_tracker.h"
#include "parser/parsetree.h"
...
...
src/backend/cdb/dispatcher/cdbgang.c
浏览文件 @
bcc8fbd6
...
...
@@ -2221,82 +2221,3 @@ int largestGangsize(void)
{
return
largest_gangsize
;
}
#ifdef USE_ASSERT_CHECKING
/**
* Assert that slicetable is valid. Must be called after ExecInitMotion, which sets up the slice table
*/
void
AssertSliceTableIsValid
(
SliceTable
*
st
,
struct
PlannedStmt
*
pstmt
)
{
if
(
!
st
)
return
;
Assert
(
pstmt
);
Assert
(
pstmt
->
nMotionNodes
==
st
->
nMotions
);
Assert
(
pstmt
->
nInitPlans
==
st
->
nInitPlans
);
ListCell
*
lc
=
NULL
;
int
i
=
0
;
int
maxIndex
=
st
->
nMotions
+
st
->
nInitPlans
+
1
;
Assert
(
maxIndex
==
list_length
(
st
->
slices
));
foreach
(
lc
,
st
->
slices
)
{
Slice
*
s
=
(
Slice
*
)
lfirst
(
lc
);
/* The n-th slice entry has sliceIndex of n */
Assert
(
s
->
sliceIndex
==
i
++
&&
"slice index incorrect"
);
/* The root index of a slice is either 0 or is a slice corresponding to an init plan */
Assert
((
s
->
rootIndex
==
0
)
||
(
s
->
rootIndex
>
st
->
nMotions
&&
s
->
rootIndex
<
maxIndex
));
/* Parent slice index */
if
(
s
->
sliceIndex
==
s
->
rootIndex
)
{
/* Current slice is a root slice. It will have parent index -1.*/
Assert
(
s
->
parentIndex
==
-
1
&&
"expecting parent index of -1"
);
}
else
{
/* All other slices must have a valid parent index */
Assert
(
s
->
parentIndex
>=
0
&&
s
->
parentIndex
<
maxIndex
&&
"slice's parent index out of range"
);
}
/* Current slice's children must consider it the parent */
ListCell
*
lc1
=
NULL
;
foreach
(
lc1
,
s
->
children
)
{
int
childIndex
=
lfirst_int
(
lc1
);
Assert
(
childIndex
>=
0
&&
childIndex
<
maxIndex
&&
"invalid child slice"
);
Slice
*
sc
=
(
Slice
*
)
list_nth
(
st
->
slices
,
childIndex
);
Assert
(
sc
->
parentIndex
==
s
->
sliceIndex
&&
"slice's child does not consider it the parent"
);
}
/* Current slice must be in its parent's children list */
if
(
s
->
parentIndex
>=
0
)
{
Slice
*
sp
=
(
Slice
*
)
list_nth
(
st
->
slices
,
s
->
parentIndex
);
bool
found
=
false
;
foreach
(
lc1
,
sp
->
children
)
{
int
childIndex
=
lfirst_int
(
lc1
);
Assert
(
childIndex
>=
0
&&
childIndex
<
maxIndex
&&
"invalid child slice"
);
Slice
*
sc
=
(
Slice
*
)
list_nth
(
st
->
slices
,
childIndex
);
if
(
sc
->
sliceIndex
==
s
->
sliceIndex
)
{
found
=
true
;
break
;
}
}
Assert
(
found
&&
"slice's parent does not consider it a child"
);
}
}
}
#endif
src/backend/commands/explain.c
浏览文件 @
bcc8fbd6
...
...
@@ -20,6 +20,7 @@
#include "commands/explain.h"
#include "commands/prepare.h"
#include "commands/trigger.h"
#include "executor/execUtils.h"
#include "executor/instrument.h"
#include "nodes/pg_list.h"
#include "nodes/print.h"
...
...
@@ -44,7 +45,6 @@
#include "cdb/cdbpathlocus.h"
#include "cdb/memquota.h"
#include "miscadmin.h"
#include "cdb/cdbgang.h"
#ifdef USE_ORCA
extern
char
*
SzDXLPlan
(
Query
*
parse
);
...
...
src/backend/executor/execMain.c
浏览文件 @
bcc8fbd6
...
...
@@ -57,6 +57,7 @@
#include "commands/trigger.h"
#include "executor/execDML.h"
#include "executor/execdebug.h"
#include "executor/execUtils.h"
#include "executor/instrument.h"
#include "executor/nodeSubplan.h"
#include "libpq/pqformat.h"
...
...
@@ -93,7 +94,6 @@
#include "cdb/ml_ipc.h"
#include "cdb/cdbmotion.h"
#include "cdb/cdbtm.h"
#include "cdb/cdbgang.h"
#include "cdb/cdboidsync.h"
#include "cdb/cdbmirroredbufferpool.h"
#include "cdb/cdbpersistentstore.h"
...
...
src/backend/executor/execUtils.c
浏览文件 @
bcc8fbd6
...
...
@@ -48,6 +48,7 @@
#include "access/appendonlywriter.h"
#include "catalog/index.h"
#include "executor/execdebug.h"
#include "executor/execUtils.h"
#include "parser/parsetree.h"
#include "utils/memutils.h"
#include "utils/relcache.h"
...
...
@@ -58,7 +59,6 @@
#include "nodes/execnodes.h"
#include "cdb/cdbutil.h"
#include "cdb/cdbgang.h"
#include "cdb/cdbvars.h"
#include "cdb/cdbdisp_query.h"
#include "cdb/cdbdispatchresult.h"
...
...
@@ -2448,3 +2448,81 @@ int RootSliceIndex(EState *estate)
return
result
;
}
#ifdef USE_ASSERT_CHECKING
/**
* Assert that slicetable is valid. Must be called after ExecInitMotion, which sets up the slice table
*/
void
AssertSliceTableIsValid
(
SliceTable
*
st
,
struct
PlannedStmt
*
pstmt
)
{
if
(
!
st
)
return
;
Assert
(
pstmt
);
Assert
(
pstmt
->
nMotionNodes
==
st
->
nMotions
);
Assert
(
pstmt
->
nInitPlans
==
st
->
nInitPlans
);
ListCell
*
lc
=
NULL
;
int
i
=
0
;
int
maxIndex
=
st
->
nMotions
+
st
->
nInitPlans
+
1
;
Assert
(
maxIndex
==
list_length
(
st
->
slices
));
foreach
(
lc
,
st
->
slices
)
{
Slice
*
s
=
(
Slice
*
)
lfirst
(
lc
);
/* The n-th slice entry has sliceIndex of n */
Assert
(
s
->
sliceIndex
==
i
++
&&
"slice index incorrect"
);
/* The root index of a slice is either 0 or is a slice corresponding to an init plan */
Assert
((
s
->
rootIndex
==
0
)
||
(
s
->
rootIndex
>
st
->
nMotions
&&
s
->
rootIndex
<
maxIndex
));
/* Parent slice index */
if
(
s
->
sliceIndex
==
s
->
rootIndex
)
{
/* Current slice is a root slice. It will have parent index -1.*/
Assert
(
s
->
parentIndex
==
-
1
&&
"expecting parent index of -1"
);
}
else
{
/* All other slices must have a valid parent index */
Assert
(
s
->
parentIndex
>=
0
&&
s
->
parentIndex
<
maxIndex
&&
"slice's parent index out of range"
);
}
/* Current slice's children must consider it the parent */
ListCell
*
lc1
=
NULL
;
foreach
(
lc1
,
s
->
children
)
{
int
childIndex
=
lfirst_int
(
lc1
);
Assert
(
childIndex
>=
0
&&
childIndex
<
maxIndex
&&
"invalid child slice"
);
Slice
*
sc
=
(
Slice
*
)
list_nth
(
st
->
slices
,
childIndex
);
Assert
(
sc
->
parentIndex
==
s
->
sliceIndex
&&
"slice's child does not consider it the parent"
);
}
/* Current slice must be in its parent's children list */
if
(
s
->
parentIndex
>=
0
)
{
Slice
*
sp
=
(
Slice
*
)
list_nth
(
st
->
slices
,
s
->
parentIndex
);
bool
found
=
false
;
foreach
(
lc1
,
sp
->
children
)
{
int
childIndex
=
lfirst_int
(
lc1
);
Assert
(
childIndex
>=
0
&&
childIndex
<
maxIndex
&&
"invalid child slice"
);
Slice
*
sc
=
(
Slice
*
)
list_nth
(
st
->
slices
,
childIndex
);
if
(
sc
->
sliceIndex
==
s
->
sliceIndex
)
{
found
=
true
;
break
;
}
}
Assert
(
found
&&
"slice's parent does not consider it a child"
);
}
}
}
#endif
src/include/cdb/cdbgang.h
浏览文件 @
bcc8fbd6
...
...
@@ -153,20 +153,6 @@ typedef struct CdbProcess
int
contentid
;
}
CdbProcess
;
extern
void
InitSliceTable
(
struct
EState
*
estate
,
int
nMotions
,
int
nSubplans
);
extern
Slice
*
getCurrentSlice
(
struct
EState
*
estate
,
int
sliceIndex
);
extern
bool
sliceRunsOnQD
(
Slice
*
slice
);
extern
bool
sliceRunsOnQE
(
Slice
*
slice
);
extern
int
sliceCalculateNumSendingProcesses
(
Slice
*
slice
);
extern
void
InitRootSlices
(
QueryDesc
*
queryDesc
);
extern
void
AssignGangs
(
QueryDesc
*
queryDesc
);
extern
void
ReleaseGangs
(
QueryDesc
*
queryDesc
);
#ifdef USE_ASSERT_CHECKING
struct
PlannedStmt
;
extern
void
AssertSliceTableIsValid
(
SliceTable
*
st
,
struct
PlannedStmt
*
pstmt
);
#endif
#endif
/* _CDBGANG_H_ */
src/include/executor/execUtils.h
0 → 100644
浏览文件 @
bcc8fbd6
/*-------------------------------------------------------------------------
*
* execUtils.h
*
* Copyright (c) 2005-2008, Greenplum inc
*
*-------------------------------------------------------------------------
*/
#ifndef _EXECUTILS_H_
#define _EXECUTILS_H_
#include "executor/execdesc.h"
struct
EState
;
struct
QueryDesc
;
extern
void
InitSliceTable
(
struct
EState
*
estate
,
int
nMotions
,
int
nSubplans
);
extern
Slice
*
getCurrentSlice
(
struct
EState
*
estate
,
int
sliceIndex
);
extern
bool
sliceRunsOnQD
(
Slice
*
slice
);
extern
bool
sliceRunsOnQE
(
Slice
*
slice
);
extern
int
sliceCalculateNumSendingProcesses
(
Slice
*
slice
);
extern
void
InitRootSlices
(
QueryDesc
*
queryDesc
);
extern
void
AssignGangs
(
QueryDesc
*
queryDesc
);
extern
void
ReleaseGangs
(
QueryDesc
*
queryDesc
);
#ifdef USE_ASSERT_CHECKING
struct
PlannedStmt
;
extern
void
AssertSliceTableIsValid
(
SliceTable
*
st
,
struct
PlannedStmt
*
pstmt
);
#endif
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录