Prevent the unnecessary creation of .ready file for the timeline history file.
authorFujii Masao
Thu, 6 Nov 2014 12:24:40 +0000 (21:24 +0900)
committerFujii Masao
Thu, 6 Nov 2014 12:25:18 +0000 (21:25 +0900)
Previously .ready file was created for the timeline history file at the end
of an archive recovery even when WAL archiving was not enabled.
This creation is unnecessary and causes .ready file to remain infinitely.

This commit changes an archive recovery so that it creates .ready file for
the timeline history file only when WAL archiving is enabled.

Backpatch to all supported versions.

src/backend/access/transam/timeline.c

index 0f34c17e1f6c6ad390a620faf2444bc00f9d4766..200808f7771a759744c8bf39728e79d62604ce58 100644 (file)
@@ -36,6 +36,7 @@
 #include 
 
 #include "access/timeline.h"
+#include "access/xlog.h"
 #include "access/xlog_internal.h"
 #include "access/xlogdefs.h"
 #include "storage/fd.h"
@@ -437,8 +438,11 @@ writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI,
 #endif
 
    /* The history file can be archived immediately. */
-   TLHistoryFileName(histfname, newTLI);
-   XLogArchiveNotify(histfname);
+   if (XLogArchivingActive())
+   {
+       TLHistoryFileName(histfname, newTLI);
+       XLogArchiveNotify(histfname);
+   }
 }
 
 /*