mirror of
https://github.com/postgres/postgres.git
synced 2025-05-03 22:24:49 +03:00
On some platforms, pg_usleep isn't interruptible by signals; fix
archiver to behave per original coder's expectation on these machines. We already know this everywhere else AFAICT.
This commit is contained in:
parent
6d54320002
commit
2dc7c88c2e
@ -19,7 +19,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.24 2006/06/27 22:16:43 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.25 2006/08/07 17:41:42 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -286,7 +286,6 @@ static void
|
|||||||
pgarch_MainLoop(void)
|
pgarch_MainLoop(void)
|
||||||
{
|
{
|
||||||
time_t last_copy_time = 0;
|
time_t last_copy_time = 0;
|
||||||
time_t curtime;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We run the copy loop immediately upon entry, in case there are
|
* We run the copy loop immediately upon entry, in case there are
|
||||||
@ -298,7 +297,6 @@ pgarch_MainLoop(void)
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Check for config update */
|
/* Check for config update */
|
||||||
if (got_SIGHUP)
|
if (got_SIGHUP)
|
||||||
{
|
{
|
||||||
@ -318,15 +316,19 @@ pgarch_MainLoop(void)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* There shouldn't be anything for the archiver to do except to wait
|
* There shouldn't be anything for the archiver to do except to wait
|
||||||
* for a signal, ... however, the archiver exists to protect our data,
|
* for a signal ... however, the archiver exists to protect our data,
|
||||||
* so she wakes up occasionally to allow herself to be proactive. In
|
* so she wakes up occasionally to allow herself to be proactive.
|
||||||
* particular this avoids getting stuck if a signal arrives just
|
*
|
||||||
* before we sleep.
|
* On some platforms, signals won't interrupt the sleep. To ensure we
|
||||||
|
* respond reasonably promptly when someone signals us, break down the
|
||||||
|
* sleep into 1-second increments, and check for interrupts after each
|
||||||
|
* nap.
|
||||||
*/
|
*/
|
||||||
if (!wakened)
|
while (!(wakened || got_SIGHUP))
|
||||||
{
|
{
|
||||||
pg_usleep(PGARCH_AUTOWAKE_INTERVAL * 1000000L);
|
time_t curtime;
|
||||||
|
|
||||||
|
pg_usleep(1000000L);
|
||||||
curtime = time(NULL);
|
curtime = time(NULL);
|
||||||
if ((unsigned int) (curtime - last_copy_time) >=
|
if ((unsigned int) (curtime - last_copy_time) >=
|
||||||
(unsigned int) PGARCH_AUTOWAKE_INTERVAL)
|
(unsigned int) PGARCH_AUTOWAKE_INTERVAL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user