After archive recovery, mark the last WAL segment from the parent timeline
authorHeikki Linnakangas <heikki@enterprisedb.com>
Wed, 22 Apr 2009 19:51:12 +0000 (19:51 +0000)
committerHeikki Linnakangas <heikki@enterprisedb.com>
Wed, 22 Apr 2009 19:51:12 +0000 (19:51 +0000)
ready for archival. It was marked at the next checkpoint anyway, but
waiting for the next checkpoint is an unnecessary delay.

Fujii Masao

src/backend/access/transam/xlog.c

index 2fc935a1fb64b2de50c3bf9dd1cacad3e460a669..820b4398fe0a4ebcd5e691d3435040b1612d2804 100644 (file)
@@ -4850,10 +4850,22 @@ exitArchiveRecovery(TimeLineID endTLI, uint32 endLogId, uint32 endLogSeg)
                 * If we are establishing a new timeline, we have to copy data from
                 * the last WAL segment of the old timeline to create a starting WAL
                 * segment for the new timeline.
+                *
+                * Notify the archiver that the last WAL segment of the old timeline
+                * is ready to copy to archival storage. Otherwise, it is not archived
+                * for a while.
                 */
                if (endTLI != ThisTimeLineID)
+               {
                        XLogFileCopy(endLogId, endLogSeg,
                                                 endTLI, endLogId, endLogSeg);
+
+                       if (XLogArchivingActive())
+                       {
+                               XLogFileName(xlogpath, endTLI, endLogId, endLogSeg);
+                               XLogArchiveNotify(xlogpath);
+                       }
+               }
        }
 
        /*