Hi all,

While reviewing the archiving code, I have bumped into the fact that
XLogArchiveCleanup() thinks that it is safe to do only a plain unlink()
for .ready and .done files when removing a past segment.  I don't think
that it is a smart move, as on a subsequent crash we may still see
those, but the related segment would have gone away.  This is not really
a problem for .done files, but it could confuse the archiver to see some
.ready files about things that have already gone away.

Attached is a patch.  Thoughts?
--
Michael
diff --git a/src/backend/access/transam/xlogarchive.c b/src/backend/access/transam/xlogarchive.c
index d40317168e..86c8383e11 100644
--- a/src/backend/access/transam/xlogarchive.c
+++ b/src/backend/access/transam/xlogarchive.c
@@ -762,11 +762,11 @@ XLogArchiveCleanup(const char *xlog)
 
 	/* Remove the .done file */
 	StatusFilePath(archiveStatusPath, xlog, ".done");
-	unlink(archiveStatusPath);
+	durable_unlink(archiveStatusPath, DEBUG1);
 	/* should we complain about failure? */
 
 	/* Remove the .ready file if present --- normally it shouldn't be */
 	StatusFilePath(archiveStatusPath, xlog, ".ready");
-	unlink(archiveStatusPath);
+	durable_unlink(archiveStatusPath, DEBUG1);
 	/* should we complain about failure? */
 }

Attachment: signature.asc
Description: PGP signature

Reply via email to