Hi,

Sorry for this late reply.

On Wed, Aug 19, 2009 at 6:45 PM, Heikki Linnakangas
<heikki.linnakan...@enterprisedb.com> wrote:
> Is pg_standby killed correctly when postmaster dies?

No. In my test (v8.3.7 on Win), an immediate shutdown was able to
kill postmaster, but not pg_standby and the startup process.

Though we should change those to handle the shutdown signals
correctly, this change is not imperative need. At first, we should
just get rid of the signal support from pg_standby on Win, in order
to avoid the pg_standby crash. The attached is the patch to do so.
If this patch is OK, the backport is required for 8.3.x.

Thought?

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center
? drop_signal_support_for_pgstandby_win32.patch
Index: contrib/pg_standby/pg_standby.c
===================================================================
RCS file: /projects/cvsroot/pgsql/contrib/pg_standby/pg_standby.c,v
retrieving revision 1.26
diff -c -r1.26 pg_standby.c
*** contrib/pg_standby/pg_standby.c	25 Jun 2009 19:33:25 -0000	1.26
--- contrib/pg_standby/pg_standby.c	4 Nov 2009 10:27:26 -0000
***************
*** 56,62 ****
--- 56,64 ----
  bool		need_cleanup = false;		/* do we need to remove files from
  										 * archive? */
  
+ #ifndef WIN32
  static volatile sig_atomic_t signaled = false;
+ #endif
  
  char	   *archiveLocation;	/* where to find the archive? */
  char	   *triggerPath;		/* where to find the trigger file? */
***************
*** 535,547 ****
  	printf("\nReport bugs to <pgsql-b...@postgresql.org>.\n");
  }
  
  static void
  sighandler(int sig)
  {
  	signaled = true;
  }
  
- #ifndef WIN32
  /* We don't want SIGQUIT to core dump */
  static void
  sigquit_handler(int sig)
--- 537,549 ----
  	printf("\nReport bugs to <pgsql-b...@postgresql.org>.\n");
  }
  
+ #ifndef WIN32
  static void
  sighandler(int sig)
  {
  	signaled = true;
  }
  
  /* We don't want SIGQUIT to core dump */
  static void
  sigquit_handler(int sig)
***************
*** 573,578 ****
--- 575,581 ----
  		}
  	}
  
+ #ifndef WIN32
  	/*
  	 * You can send SIGUSR1 to trigger failover.
  	 *
***************
*** 584,593 ****
  	 * out to be a bad idea because postmaster uses SIGQUIT to request
  	 * immediate shutdown. We still trap SIGINT, but that may change in a
  	 * future release.
  	 */
  	(void) signal(SIGUSR1, sighandler);
  	(void) signal(SIGINT, sighandler);	/* deprecated, use SIGUSR1 */
- #ifndef WIN32
  	(void) signal(SIGQUIT, sigquit_handler);
  #endif
  
--- 587,597 ----
  	 * out to be a bad idea because postmaster uses SIGQUIT to request
  	 * immediate shutdown. We still trap SIGINT, but that may change in a
  	 * future release.
+ 	 *
+ 	 * There's no way to trigger failover via signal on Windows.
  	 */
  	(void) signal(SIGUSR1, sighandler);
  	(void) signal(SIGINT, sighandler);	/* deprecated, use SIGUSR1 */
  	(void) signal(SIGQUIT, sigquit_handler);
  #endif
  
***************
*** 763,768 ****
--- 767,773 ----
  	{
  		/* Check for trigger file or signal first */
  		CheckForExternalTrigger();
+ #ifndef WIN32
  		if (signaled)
  		{
  			Failover = FastFailover;
***************
*** 772,777 ****
--- 777,783 ----
  				fflush(stderr);
  			}
  		}
+ #endif
  
  		/*
  		 * Check for fast failover immediately, before checking if the
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to