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

Commit47ce595

Browse files
committed
Don't intercept SIGQUIT as a signal to trigger failover; that's what
postmaster uses for immediate shutdown. Trap SIGUSR1 as the preferredsignal for that.Per report by Fujii Masao and subsequent discussion on -hackers.
1 parentafcde99 commit47ce595

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

‎contrib/pg_standby/pg_standby.c

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* $PostgreSQL: pgsql/contrib/pg_standby/pg_standby.c,v 1.18 2009/02/27 09:30:21 petere Exp $
2+
* $PostgreSQL: pgsql/contrib/pg_standby/pg_standby.c,v 1.19 2009/03/18 19:27:28 heikki Exp $
33
*
44
*
55
* pg_standby.c
@@ -463,6 +463,15 @@ sighandler(int sig)
463463
signaled= true;
464464
}
465465

466+
/* We don't want SIGQUIT to core dump */
467+
staticvoid
468+
sigquit_handler(intsig)
469+
{
470+
signal(SIGINT,SIG_DFL);
471+
kill(getpid(),SIGINT);
472+
}
473+
474+
466475
/*------------ MAIN ----------------------------------------*/
467476
int
468477
main(intargc,char**argv)
@@ -485,8 +494,21 @@ main(int argc, char **argv)
485494
}
486495
}
487496

488-
(void)signal(SIGINT,sighandler);
489-
(void)signal(SIGQUIT,sighandler);
497+
/*
498+
* You can send SIGUSR1 to trigger failover.
499+
*
500+
* Postmaster uses SIGQUIT to request immediate shutdown. The default
501+
* action is to core dump, but we don't want that, so trap it and
502+
* commit suicide without core dump.
503+
*
504+
* We used to use SIGINT and SIGQUIT to trigger failover, but that
505+
* turned out to be a bad idea because postmaster uses SIGQUIT to
506+
* request immediate shutdown. We still trap SIGINT, but that may
507+
* change in a future release.
508+
*/
509+
(void)signal(SIGUSR1,sighandler);
510+
(void)signal(SIGINT,sighandler);/* deprecated, use SIGUSR1 */
511+
(void)signal(SIGQUIT,sigquit_handler);
490512

491513
while ((c=getopt(argc,argv,"cdk:lr:s:t:w:"))!=-1)
492514
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp