Jon Colverson wrote:
> I've been testing my DB backup and restore procedure and I've run into
> something I can't figure out. After recovering from a PITR backup, when
> I do another pg_start_backup PostgreSQL attempts to re-archive the last
> log again, which fails because it already exists in the archive.
Hello again. I've been investigating this some more and I've got some
more details to add:
In xlog.c, exitArchiveRecovery() moves the last restored log file into
XLOGDIR.
Later (when shutting down the cluster, for instance),
XLogArchiveCheckDone() is called on the log file. This function looks
for a ".done" or ".ready" file and finds neither, so it calls
XLogArchiveNotify() to create the ".ready" file. This causes the
archiver to come along later and attempt to archive the log and this
fails because the log already exists in the archive (that's where it
came from).
So, I think the problem is that exitArchiveRecovery() should be marking
the restored log file as ".done" (or perhaps not bothering to restore
the log file at all?).
This looks like a bug to me. Any thoughts?
--
Jon