signal and startup process
Hi,
It takes nonsensically extra several seconds to shut down the standby server.
This is because the startup process cannot respond immediately the SIGTERM
signal sent by postmaster for the shutdown while it's sleeping on WaitLatch.
This delays the shutdown for up to the sleep time on WaitLatch (currently
5 seconds).
The signal handlers of the startup process should call SetLatch to respond
the signals even while it's sleeping on WaitLatch, like those of walsender
already do. The attached patch does this.
Regards,
--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center
Attachments:
signal_handler_wakeup_recovery_v1.patchapplication/octet-stream; name=signal_handler_wakeup_recovery_v1.patchDownload
*** a/src/backend/access/transam/xlog.c
--- b/src/backend/access/transam/xlog.c
***************
*** 9174,9179 **** static void
--- 9174,9180 ----
StartupProcSigHupHandler(SIGNAL_ARGS)
{
got_SIGHUP = true;
+ WakeupRecovery();
}
/* SIGTERM: set flag to abort redo and exit */
***************
*** 9184,9189 **** StartupProcShutdownHandler(SIGNAL_ARGS)
--- 9185,9191 ----
proc_exit(1);
else
shutdown_requested = true;
+ WakeupRecovery();
}
/* Handle SIGHUP and SIGTERM signals of startup process */
Committed.
On Thu, 2010-10-14 at 12:57 +0900, Fujii Masao wrote:
Hi,
It takes nonsensically extra several seconds to shut down the standby server.
This is because the startup process cannot respond immediately the SIGTERM
signal sent by postmaster for the shutdown while it's sleeping on WaitLatch.
This delays the shutdown for up to the sleep time on WaitLatch (currently
5 seconds).The signal handlers of the startup process should call SetLatch to respond
the signals even while it's sleeping on WaitLatch, like those of walsender
already do. The attached patch does this.Regards,
--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Training and Services