diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-08-07 17:41:42 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-08-07 17:41:42 +0000 |
commit | 2dc7c88c2ec277ea3b1e816a6eaf048b78d35b90 (patch) | |
tree | b8a13da568922eb6002750bbaa53158fd12d6b0e /src | |
parent | 6d54320002a7ff5cc9233dffa38c9a571d9cb30e (diff) | |
download | postgresql-2dc7c88c2ec277ea3b1e816a6eaf048b78d35b90.tar.gz postgresql-2dc7c88c2ec277ea3b1e816a6eaf048b78d35b90.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/postmaster/pgarch.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/backend/postmaster/pgarch.c b/src/backend/postmaster/pgarch.c index bcf1b2dcafb..30845068207 100644 --- a/src/backend/postmaster/pgarch.c +++ b/src/backend/postmaster/pgarch.c @@ -19,7 +19,7 @@ * * * 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) { time_t last_copy_time = 0; - time_t curtime; /* * We run the copy loop immediately upon entry, in case there are @@ -298,7 +297,6 @@ pgarch_MainLoop(void) do { - /* Check for config update */ if (got_SIGHUP) { @@ -318,15 +316,19 @@ pgarch_MainLoop(void) /* * There shouldn't be anything for the archiver to do except to wait - * for a signal, ... however, the archiver exists to protect our data, - * so she wakes up occasionally to allow herself to be proactive. In - * particular this avoids getting stuck if a signal arrives just - * before we sleep. + * for a signal ... however, the archiver exists to protect our data, + * so she wakes up occasionally to allow herself to be proactive. + * + * 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); if ((unsigned int) (curtime - last_copy_time) >= (unsigned int) PGARCH_AUTOWAKE_INTERVAL) |