Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
fdc8bea9
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,发现更多精彩内容 >>
提交
fdc8bea9
编写于
3月 13, 2019
作者:
T
Teng zhang
提交者:
Teng Zhang
4月 08, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add node hook in MultiExecProcNode
上级
e153c1ee
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
46 addition
and
6 deletion
+46
-6
src/backend/executor/execProcnode.c
src/backend/executor/execProcnode.c
+8
-0
src/test/regress/input/query_info_hook_test.source
src/test/regress/input/query_info_hook_test.source
+4
-1
src/test/regress/output/query_info_hook_test.source
src/test/regress/output/query_info_hook_test.source
+31
-4
src/test/regress/query_info_hook_test/query_info_hook_test.c
src/test/regress/query_info_hook_test/query_info_hook_test.c
+3
-1
未找到文件。
src/backend/executor/execProcnode.c
浏览文件 @
fdc8bea9
...
...
@@ -1189,6 +1189,14 @@ MultiExecProcNode(PlanState *node)
START_MEMORY_ACCOUNT
(
node
->
memoryAccountId
);
{
TRACE_POSTGRESQL_EXECPROCNODE_ENTER
(
GpIdentity
.
segindex
,
currentSliceId
,
nodeTag
(
node
),
node
->
plan
->
plan_node_id
);
if
(
!
node
->
fHadSentNodeStart
)
{
/* GPDB hook for collecting query info */
if
(
query_info_collect_hook
)
(
*
query_info_collect_hook
)(
METRICS_PLAN_NODE_EXECUTING
,
node
);
node
->
fHadSentNodeStart
=
true
;
}
if
(
node
->
chgParam
!=
NULL
)
/* something changed */
ExecReScan
(
node
);
/* let ReScan handle this */
...
...
src/test/regress/input/query_info_hook_test.source
浏览文件 @
fdc8bea9
LOAD '@abs_builddir@/query_info_hook_test/query_info_hook_test@DLSUFFIX@';
SET client_min_messages='warning';
SET optimizer=off;
-- Test Normal case
SELECT * FROM generate_series(1, 3);
...
...
@@ -17,7 +18,9 @@ SELECT * FROM generate_series(1, 3/0);
-- Test query abort
select pg_cancel_backend(pg_backend_pid());
-- Test alter table set distributed by
CREATE TABLE queryInfoHookTable1 (id int, name text) DISTRIBUTED BY(id);
ALTER TABLE queryInfoHookTable1 SET DISTRIBUTED BY (name);
-- Test Hash node
CREATE TABLE tb_a(a int);
SELECT a FROM tb_a WHERE a IN (SELECT max(a) FROM tb_a);
src/test/regress/output/query_info_hook_test.source
浏览文件 @
fdc8bea9
LOAD '@abs_builddir@/query_info_hook_test/query_info_hook_test@DLSUFFIX@';
SET client_min_messages='warning';
SET optimizer=off;
-- Test Normal case
SELECT * FROM generate_series(1, 3);
WARNING: Query submit
WARNING: Query start
WARNING: Plan node initializing
WARNING: Plan node executing
WARNING: Plan node executing
node_type: FUNCTIONSCAN
WARNING: Plan node finished
WARNING: Query Done
generate_series
...
...
@@ -25,7 +26,7 @@ SELECT * FROM error_in_execution();
WARNING: Query submit
WARNING: Query start
WARNING: Plan node initializing
WARNING: Plan node executing
WARNING: Plan node executing
node_type: FUNCTIONSCAN
WARNING: Query Error
ERROR: error in function execution
-- Test Error case: Error out in planner.
...
...
@@ -36,7 +37,7 @@ select pg_cancel_backend(pg_backend_pid());
WARNING: Query submit
WARNING: Query start
WARNING: Plan node initializing
WARNING: Plan node executing
WARNING: Plan node executing
node_type: RESULT
WARNING: Query Canceling
WARNING: Query Canceled
ERROR: canceling statement due to user request
...
...
@@ -46,12 +47,38 @@ ALTER TABLE queryInfoHookTable1 SET DISTRIBUTED BY (name);
WARNING: Query submit
WARNING: Query start
WARNING: Plan node initializing
WARNING: Plan node executing
WARNING: Plan node executing
node_type: RESULT
WARNING: Plan node finished
WARNING: Query Done
WARNING: Query submit
WARNING: Query start
WARNING: Plan node initializing
WARNING: Plan node executing node_type: MOTION
WARNING: Plan node finished
WARNING: Plan node finished
WARNING: Query Done
-- Test Hash node
CREATE TABLE tb_a(a int);
SELECT a FROM tb_a WHERE a IN (SELECT max(a) FROM tb_a);
WARNING: Query submit
WARNING: Query start
WARNING: Plan node initializing
WARNING: Plan node executing node_type: MOTION
WARNING: Plan node executing node_type: HASHJOIN
WARNING: Plan node executing node_type: HASH
WARNING: Plan node finished
WARNING: Query Done
WARNING: Plan node finished
WARNING: Plan node finished
WARNING: Plan node finished
WARNING: Plan node finished
WARNING: Plan node finished
WARNING: Plan node finished
WARNING: Plan node finished
WARNING: Plan node finished
WARNING: Plan node finished
WARNING: Query Done
a
---
(0 rows)
src/test/regress/query_info_hook_test/query_info_hook_test.c
浏览文件 @
fdc8bea9
...
...
@@ -2,6 +2,8 @@
#include "fmgr.h"
#include "utils/metrics_utils.h"
#include "nodes/execnodes.h"
#include "nodes/print.h"
PG_MODULE_MAGIC
;
...
...
@@ -35,7 +37,7 @@ test_hook(QueryMetricsStatus status, void* args)
ereport
(
WARNING
,
(
errmsg
(
"Plan node initializing"
)));
break
;
case
METRICS_PLAN_NODE_EXECUTING
:
ereport
(
WARNING
,
(
errmsg
(
"Plan node executing
"
)));
ereport
(
WARNING
,
(
errmsg
(
"Plan node executing
node_type: %s"
,
plannode_type
(((
PlanState
*
)
args
)
->
plan
)
)));
break
;
case
METRICS_PLAN_NODE_FINISHED
:
ereport
(
WARNING
,
(
errmsg
(
"Plan node finished"
)));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录