From 18c2d47b1d5dd3c0439f990ee4da6b305d477ca4 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Thu, 9 Oct 2014 15:04:26 +0900 Subject: [PATCH 1/2] Fix apparition of archive status files of .ready on streaming standbys Commit 1bd42cd has removed a check based on the recovery status of a node when removing old WAL segment files in pg_xlog, causing the apparition of .ready files that prevented the removal of some WAL segment files that remained stuck in the archive folder. Note that this does not prevent the abscence of some .done files as it may still be possible that some segments cannot be marked correctly as complete after their stream is done in the case for example of an abrupt disconnection between a standby and its root node, but it ensures that when a node is in recovery old WAL segment files are removed whatever their status in the folder archive_status. Per report from Jehan-Guillaume de Rorthais. --- src/backend/access/transam/xlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 5a4dbb9..39701a3 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -3771,7 +3771,7 @@ RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr endptr) strspn(xlde->d_name, "0123456789ABCDEF") == 24 && strcmp(xlde->d_name + 8, lastoff + 8) <= 0) { - if (XLogArchiveCheckDone(xlde->d_name)) + if (RecoveryInProgress() || XLogArchiveCheckDone(xlde->d_name)) { snprintf(path, MAXPGPATH, XLOGDIR "/%s", xlde->d_name); -- 2.1.2