PostmasterIsAlive test really ought to be in the inner loop for safety.
authorTom Lane
Tue, 30 May 2006 17:08:14 +0000 (17:08 +0000)
committerTom Lane
Tue, 30 May 2006 17:08:14 +0000 (17:08 +0000)
src/backend/postmaster/pgarch.c

index 3b6cc9d5d9749f67cafeff296ac1ea9e81ccce48..9a8f24e5dbb916f221724efa1438a8798d045eb5 100644 (file)
@@ -19,7 +19,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.21 2006/05/30 13:30:49 momjian Exp $
+ *   $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.22 2006/05/30 17:08:14 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -352,12 +352,16 @@ pgarch_ArchiverCopyLoop(void)
     * some backend will add files onto the list of those that need archiving
     * while we are still copying earlier archives
     */
-   while (PostmasterIsAlive(true) && pgarch_readyXlog(xlog))
+   while (pgarch_readyXlog(xlog))
    {
        int         failures = 0;
 
        for (;;)
        {
+           /* Abandon processing if we notice our postmaster has died */
+           if (!PostmasterIsAlive(true))
+               return;
+
            if (pgarch_archiveXlog(xlog))
            {
                /* successful */