Skip to content

Commit 4a69624

Browse files
committed
Cause the archiver process to adopt new postgresql.conf settings (particularly
archive_command) as soon as possible, namely just before issuing a new call of archive_command, even when there is a backlog of files to be archived. The original coding would only absorb new settings after clearing the backlog and returning to the outer loop. Per discussion. Back-patch to 8.3. The logic in prior versions is a bit different and it doesn't seem worth taking any risks of breaking it.
1 parent 8b8009a commit 4a69624

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

src/backend/postmaster/pgarch.c

Lines changed: 20 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.41 2010/01/02 16:57:50 momjian Exp $
22+
* $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.42 2010/05/11 16:42:28 tgl Exp $
2323
*
2424
*-------------------------------------------------------------------------
2525
*/
@@ -410,14 +410,6 @@ pgarch_ArchiverCopyLoop(void)
410410
{
411411
char xlog[MAX_XFN_CHARS + 1];
412412

413-
if (!XLogArchiveCommandSet())
414-
{
415-
ereport(WARNING,
416-
(errmsg("archive_mode enabled, yet archive_command is not set")));
417-
/* can't do anything if no command ... */
418-
return;
419-
}
420-
421413
/*
422414
* loop through all xlogs with archive_status of .ready and archive
423415
* them...mostly we expect this to be a single file, though it is possible
@@ -440,6 +432,25 @@ pgarch_ArchiverCopyLoop(void)
440432
if (got_SIGTERM || !PostmasterIsAlive(true))
441433
return;
442434

435+
/*
436+
* Check for config update. This is so that we'll adopt a new
437+
* setting for archive_command as soon as possible, even if there
438+
* is a backlog of files to be archived.
439+
*/
440+
if (got_SIGHUP)
441+
{
442+
got_SIGHUP = false;
443+
ProcessConfigFile(PGC_SIGHUP);
444+
}
445+
446+
/* can't do anything if no command ... */
447+
if (!XLogArchiveCommandSet())
448+
{
449+
ereport(WARNING,
450+
(errmsg("archive_mode enabled, yet archive_command is not set")));
451+
return;
452+
}
453+
443454
if (pgarch_archiveXlog(xlog))
444455
{
445456
/* successful */

0 commit comments

Comments
 (0)