Skip to content

Commit 48912ac

Browse files
committed
Disable triggering failover with a signal in pg_standby on Windows, because
Windows doesn't do signal processing like other platforms do. It never really worked, but recent changes to the signal handling made it crash. This fixes bug #4961. Patch by Fujii Masao.
1 parent 91ce16a commit 48912ac

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

contrib/pg_standby/pg_standby.c

Lines changed: 9 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.26 2009/06/25 19:33:25 tgl Exp $
2+
* $PostgreSQL: pgsql/contrib/pg_standby/pg_standby.c,v 1.27 2009/11/04 12:51:30 heikki Exp $
33
*
44
*
55
* pg_standby.c
@@ -56,7 +56,9 @@ bool debug = false; /* are we debugging? */
5656
bool need_cleanup = false; /* do we need to remove files from
5757
* archive? */
5858

59+
#ifndef WIN32
5960
static volatile sig_atomic_t signaled = false;
61+
#endif
6062

6163
char *archiveLocation; /* where to find the archive? */
6264
char *triggerPath; /* where to find the trigger file? */
@@ -535,13 +537,13 @@ usage(void)
535537
printf("\nReport bugs to <pgsql-bugs@postgresql.org>.\n");
536538
}
537539

540+
#ifndef WIN32
538541
static void
539542
sighandler(int sig)
540543
{
541544
signaled = true;
542545
}
543546

544-
#ifndef WIN32
545547
/* We don't want SIGQUIT to core dump */
546548
static void
547549
sigquit_handler(int sig)
@@ -573,6 +575,7 @@ main(int argc, char **argv)
573575
}
574576
}
575577

578+
#ifndef WIN32
576579
/*
577580
* You can send SIGUSR1 to trigger failover.
578581
*
@@ -584,10 +587,11 @@ main(int argc, char **argv)
584587
* out to be a bad idea because postmaster uses SIGQUIT to request
585588
* immediate shutdown. We still trap SIGINT, but that may change in a
586589
* future release.
590+
*
591+
* There's no way to trigger failover via signal on Windows.
587592
*/
588593
(void) signal(SIGUSR1, sighandler);
589594
(void) signal(SIGINT, sighandler); /* deprecated, use SIGUSR1 */
590-
#ifndef WIN32
591595
(void) signal(SIGQUIT, sigquit_handler);
592596
#endif
593597

@@ -763,6 +767,7 @@ main(int argc, char **argv)
763767
{
764768
/* Check for trigger file or signal first */
765769
CheckForExternalTrigger();
770+
#ifndef WIN32
766771
if (signaled)
767772
{
768773
Failover = FastFailover;
@@ -772,6 +777,7 @@ main(int argc, char **argv)
772777
fflush(stderr);
773778
}
774779
}
780+
#endif
775781

776782
/*
777783
* Check for fast failover immediately, before checking if the

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy