Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
65865717
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,发现更多精彩内容 >>
提交
65865717
编写于
9月 19, 2005
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Print proper cause of statement cancel, user interaction or timeout.
上级
591a29b3
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
35 addition
and
13 deletion
+35
-13
doc/src/sgml/config.sgml
doc/src/sgml/config.sgml
+5
-2
src/backend/storage/lmgr/proc.c
src/backend/storage/lmgr/proc.c
+13
-3
src/backend/tcop/postgres.c
src/backend/tcop/postgres.c
+12
-5
src/include/storage/proc.h
src/include/storage/proc.h
+3
-1
src/test/regress/expected/prepared_xacts.out
src/test/regress/expected/prepared_xacts.out
+2
-2
未找到文件。
doc/src/sgml/config.sgml
浏览文件 @
65865717
<!--
$PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.1
7 2005/09/13 15:24:56 neilc
Exp $
$PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.1
8 2005/09/19 17:21:46 momjian
Exp $
-->
<chapter Id="runtime-config">
<title>Run-time Configuration</title>
...
...
@@ -3232,7 +3232,10 @@ SELECT * FROM parent WHERE key = 2400;
<listitem>
<para>
Abort any statement that takes over the specified number of
milliseconds. A value of zero (the default) turns off the limitation.
milliseconds. If <varname>log_min_error_statement</> is set to
<literal>ERROR</> or lower, the statement that timed out will also be
logged. A value of zero (the default) turns off the
limitation.
</para>
</listitem>
</varlistentry>
...
...
src/backend/storage/lmgr/proc.c
浏览文件 @
65865717
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.16
3 2005/08/20 23:26:24 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.16
4 2005/09/19 17:21:47 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -78,6 +78,7 @@ static bool waitingForLock = false;
/* Mark these volatile because they can be changed by signal handler */
static
volatile
bool
statement_timeout_active
=
false
;
static
volatile
bool
deadlock_timeout_active
=
false
;
volatile
bool
cancel_from_timeout
=
false
;
/* statement_fin_time is valid only if statement_timeout_active is true */
static
struct
timeval
statement_fin_time
;
...
...
@@ -1058,6 +1059,7 @@ enable_sig_alarm(int delayms, bool is_statement_timeout)
Assert
(
!
deadlock_timeout_active
);
statement_fin_time
=
fin_time
;
statement_timeout_active
=
true
;
cancel_from_timeout
=
false
;
}
else
if
(
statement_timeout_active
)
{
...
...
@@ -1128,14 +1130,18 @@ disable_sig_alarm(bool is_statement_timeout)
MemSet
(
&
timeval
,
0
,
sizeof
(
struct
itimerval
));
if
(
setitimer
(
ITIMER_REAL
,
&
timeval
,
NULL
))
{
statement_timeout_active
=
deadlock_timeout_active
=
false
;
statement_timeout_active
=
false
;
cancel_from_timeout
=
false
;
deadlock_timeout_active
=
false
;
return
false
;
}
#else
/* BeOS doesn't have setitimer, but has set_alarm */
if
(
set_alarm
(
B_INFINITE_TIMEOUT
,
B_PERIODIC_ALARM
)
<
0
)
{
statement_timeout_active
=
deadlock_timeout_active
=
false
;
statement_timeout_active
=
false
;
cancel_from_timeout
=
false
;
deadlock_timeout_active
=
false
;
return
false
;
}
#endif
...
...
@@ -1146,7 +1152,10 @@ disable_sig_alarm(bool is_statement_timeout)
/* Cancel or reschedule statement timeout */
if
(
is_statement_timeout
)
{
statement_timeout_active
=
false
;
cancel_from_timeout
=
false
;
}
else
if
(
statement_timeout_active
)
{
if
(
!
CheckStatementTimeout
())
...
...
@@ -1179,6 +1188,7 @@ CheckStatementTimeout(void)
{
/* Time to die */
statement_timeout_active
=
false
;
cancel_from_timeout
=
true
;
kill
(
MyProcPid
,
SIGINT
);
}
else
...
...
src/backend/tcop/postgres.c
浏览文件 @
65865717
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.4
59 2005/09/16 19:31:04
momjian Exp $
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.4
60 2005/09/19 17:21:47
momjian Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
...
...
@@ -1979,7 +1979,9 @@ start_xact_command(void)
/* Set statement timeout running, if any */
if
(
StatementTimeout
>
0
)
enable_sig_alarm
(
StatementTimeout
,
true
);
else
cancel_from_timeout
=
false
;
xact_started
=
true
;
}
}
...
...
@@ -2203,9 +2205,14 @@ ProcessInterrupts(void)
ImmediateInterruptOK
=
false
;
/* not idle anymore */
DisableNotifyInterrupt
();
DisableCatchupInterrupt
();
ereport
(
ERROR
,
(
errcode
(
ERRCODE_QUERY_CANCELED
),
errmsg
(
"canceling query due to user request or statement timeout"
)));
if
(
cancel_from_timeout
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_QUERY_CANCELED
),
errmsg
(
"canceling statement due to statement timeout"
)));
else
ereport
(
ERROR
,
(
errcode
(
ERRCODE_QUERY_CANCELED
),
errmsg
(
"canceling statement due to user request"
)));
}
/* If we get here, do nothing (probably, QueryCancelPending was reset) */
}
...
...
src/include/storage/proc.h
浏览文件 @
65865717
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/storage/proc.h,v 1.8
1 2005/08/20 23:26:34 tgl
Exp $
* $PostgreSQL: pgsql/src/include/storage/proc.h,v 1.8
2 2005/09/19 17:21:48 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -117,6 +117,8 @@ typedef struct PROC_HDR
extern
int
DeadlockTimeout
;
extern
int
StatementTimeout
;
extern
volatile
bool
cancel_from_timeout
;
/*
* Function Prototypes
...
...
src/test/regress/expected/prepared_xacts.out
浏览文件 @
65865717
...
...
@@ -159,7 +159,7 @@ SELECT gid FROM pg_prepared_xacts;
-- pxtest3 should be locked because of the pending DROP
set statement_timeout to 1000;
SELECT * FROM pxtest3;
ERROR: canceling
query due to user request or
statement timeout
ERROR: canceling
statement due to
statement timeout
reset statement_timeout;
-- Disconnect, we will continue testing in a different backend
\c -
...
...
@@ -174,7 +174,7 @@ SELECT gid FROM pg_prepared_xacts;
-- pxtest3 should still be locked because of the pending DROP
set statement_timeout to 1000;
SELECT * FROM pxtest3;
ERROR: canceling
query due to user request or
statement timeout
ERROR: canceling
statement due to
statement timeout
reset statement_timeout;
-- Commit table creation
COMMIT PREPARED 'regress-one';
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录