Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf659ec5

Browse files
committed
Fix for deadlock timer timeout.
1 parent550de5d commitf659ec5

File tree

1 file changed

+9
-15
lines changed
  • src/backend/storage/lmgr

1 file changed

+9
-15
lines changed

‎src/backend/storage/lmgr/proc.c

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.44 1998/12/18 19:45:37 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.45 1998/12/29 18:29:18 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -46,7 +46,7 @@
4646
*This is so that we can support more backends. (system-wide semaphore
4747
*sets run out pretty fast.) -ay 4/95
4848
*
49-
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.44 1998/12/18 19:45:37 momjian Exp $
49+
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.45 1998/12/29 18:29:18 momjian Exp $
5050
*/
5151
#include<sys/time.h>
5252
#include<unistd.h>
@@ -449,7 +449,6 @@ ProcSleep(PROC_QUEUE *waitQueue,/* lock->waitProcs */
449449
inti;
450450
booldeadlock_checked= false;
451451
PROC*proc;
452-
structtimevaltimeval;
453452

454453
/*
455454
* If the first entries in the waitQueue have a greater priority than
@@ -513,29 +512,24 @@ ProcSleep(PROC_QUEUE *waitQueue,/* lock->waitProcs */
513512
SpinRelease(spinlock);
514513

515514
/* --------------
516-
* We set this so we can wake upperiodically and check for a deadlock.
515+
* We set this so we can wake upafter one second to check for a deadlock.
517516
* If a deadlock is detected, the handler releases the processes
518517
* semaphore and aborts the current transaction.
519-
*
520-
* Need to zero out struct to set the interval and the micro seconds fields
521-
* to 0.
522518
* --------------
523519
*/
524-
MemSet(&timeval,0,sizeof(structtimeval));
525-
timeval.tv_sec= \
526-
(DeadlockCheckTimer ?DeadlockCheckTimer :DEADLOCK_CHECK_TIMER);
527520

528521
do
529522
{
530-
intexpire;
523+
intexpired;
531524

532525
MyProc->errType=NO_ERROR;/* reset flag after deadlock check */
533526

534-
if ((expire=select(0,NULL,NULL,NULL,
535-
(deadlock_checked== false) ?&timeval :NULL))==-1)
536-
elog(FATAL,"ProcSleep: Unable to set timer for process wakeup");
527+
if (deadlock_checked== false)
528+
expired=sleep(DeadlockCheckTimer ?DeadlockCheckTimer :DEADLOCK_CHECK_TIMER);
529+
else
530+
pause();
537531

538-
if (expire==0/* timeout reached */&&deadlock_checked== false)
532+
if (expired==0&&deadlock_checked== false)
539533
{
540534
HandleDeadLock();
541535
deadlock_checked= true;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp