Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
6059c5a1
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,发现更多精彩内容 >>
提交
6059c5a1
编写于
12月 29, 1998
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update for deadlock detection.
上级
06c120e6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
18 deletion
+29
-18
src/backend/storage/lmgr/proc.c
src/backend/storage/lmgr/proc.c
+29
-18
未找到文件。
src/backend/storage/lmgr/proc.c
浏览文件 @
6059c5a1
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.4
6 1998/12/29 18:36:29
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.4
7 1998/12/29 19:32:08
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -46,7 +46,7 @@
* This is so that we can support more backends. (system-wide semaphore
* sets run out pretty fast.) -ay 4/95
*
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.4
6 1998/12/29 18:36:29
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.4
7 1998/12/29 19:32:08
momjian Exp $
*/
#include <sys/time.h>
#include <unistd.h>
...
...
@@ -77,7 +77,7 @@
#include "storage/proc.h"
#include "utils/trace.h"
static
void
HandleDeadLock
(
void
);
static
void
HandleDeadLock
(
int
sig
);
static
PROC
*
ProcWakeup
(
PROC
*
proc
,
int
errType
);
#define DeadlockCheckTimer pg_options[OPT_DEADLOCKTIMEOUT]
...
...
@@ -154,6 +154,8 @@ InitProcess(IPCKey key)
* Routine called if deadlock timer goes off. See ProcSleep()
* ------------------
*/
pqsignal
(
SIGALRM
,
HandleDeadLock
);
SpinAcquire
(
ProcStructLock
);
/* attach to the free list */
...
...
@@ -447,8 +449,10 @@ ProcSleep(PROC_QUEUE *waitQueue,/* lock->waitProcs */
TransactionId
xid
)
/* needed by user locks, see below */
{
int
i
;
bool
deadlock_checked
=
false
;
PROC
*
proc
;
bool
deadlock_checked
=
false
;
struct
itimerval
timeval
,
dummy
;
/*
* If the first entries in the waitQueue have a greater priority than
...
...
@@ -512,28 +516,27 @@ ProcSleep(PROC_QUEUE *waitQueue,/* lock->waitProcs */
SpinRelease
(
spinlock
);
/* --------------
* We set this so we can wake up
after one second to
check for a deadlock.
* We set this so we can wake up
periodically and
check for a deadlock.
* If a deadlock is detected, the handler releases the processes
* semaphore and aborts the current transaction.
*
* Need to zero out struct to set the interval and the micro seconds fields
* to 0.
* --------------
*/
MemSet
(
&
timeval
,
0
,
sizeof
(
struct
itimerval
));
timeval
.
it_value
.
tv_sec
=
\
(
DeadlockCheckTimer
?
DeadlockCheckTimer
:
DEADLOCK_CHECK_TIMER
);
do
{
MyProc
->
errType
=
NO_ERROR
;
/* reset flag after deadlock check */
if
(
deadlock_checked
==
false
)
{
if
(
sleep
(
DeadlockCheckTimer
?
DeadlockCheckTimer
:
DEADLOCK_CHECK_TIMER
)
==
0
/* no signal interruption */
)
{
HandleDeadLock
();
deadlock_checked
=
true
;
}
}
else
pause
();
if
(
!
deadlock_checked
)
if
(
setitimer
(
ITIMER_REAL
,
&
timeval
,
&
dummy
))
elog
(
FATAL
,
"ProcSleep: Unable to set timer for process wakeup"
);
deadlock_checked
=
true
;
/* --------------
* if someone wakes us between SpinRelease and IpcSemaphoreLock,
* IpcSemaphoreLock will not block. The wakeup is "saved" by
...
...
@@ -545,6 +548,14 @@ ProcSleep(PROC_QUEUE *waitQueue,/* lock->waitProcs */
}
while
(
MyProc
->
errType
==
STATUS_NOT_FOUND
);
/* sleep after deadlock
* check */
/* ---------------
* We were awoken before a timeout - now disable the timer
* ---------------
*/
timeval
.
it_value
.
tv_sec
=
0
;
if
(
setitimer
(
ITIMER_REAL
,
&
timeval
,
&
dummy
))
elog
(
FATAL
,
"ProcSleep: Unable to diable timer for process wakeup"
);
/* ----------------
* We were assumed to be in a critical section when we went
* to sleep.
...
...
@@ -687,7 +698,7 @@ ProcAddLock(SHM_QUEUE *elem)
* --------------------
*/
static
void
HandleDeadLock
()
HandleDeadLock
(
int
sig
)
{
LOCK
*
mywaitlock
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录