Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2dc7c88

Browse files
committed
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.
1 parent6d54320 commit2dc7c88

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

‎src/backend/postmaster/pgarch.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*
2020
*
2121
* IDENTIFICATION
22-
* $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.24 2006/06/27 22:16:43 momjian Exp $
22+
* $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.25 2006/08/07 17:41:42 tgl Exp $
2323
*
2424
*-------------------------------------------------------------------------
2525
*/
@@ -286,7 +286,6 @@ static void
286286
pgarch_MainLoop(void)
287287
{
288288
time_tlast_copy_time=0;
289-
time_tcurtime;
290289

291290
/*
292291
* We run the copy loop immediately upon entry, in case there are
@@ -298,7 +297,6 @@ pgarch_MainLoop(void)
298297

299298
do
300299
{
301-
302300
/* Check for config update */
303301
if (got_SIGHUP)
304302
{
@@ -318,15 +316,19 @@ pgarch_MainLoop(void)
318316

319317
/*
320318
* There shouldn't be anything for the archiver to do except to wait
321-
* for a signal, ... however, the archiver exists to protect our data,
322-
* so she wakes up occasionally to allow herself to be proactive. In
323-
* particular this avoids getting stuck if a signal arrives just
324-
* before we sleep.
319+
* for a signal ... however, the archiver exists to protect our data,
320+
* so she wakes up occasionally to allow herself to be proactive.
321+
*
322+
* On some platforms, signals won't interrupt the sleep. To ensure we
323+
* respond reasonably promptly when someone signals us, break down the
324+
* sleep into 1-second increments, and check for interrupts after each
325+
* nap.
325326
*/
326-
if (!wakened)
327+
while (!(wakened||got_SIGHUP))
327328
{
328-
pg_usleep(PGARCH_AUTOWAKE_INTERVAL*1000000L);
329+
time_tcurtime;
329330

331+
pg_usleep(1000000L);
330332
curtime=time(NULL);
331333
if ((unsignedint) (curtime-last_copy_time) >=
332334
(unsignedint)PGARCH_AUTOWAKE_INTERVAL)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp