Re: Attempt to re-archive existing WAL logs after restoring from backup

From: Jon Colverson <pgsql(at)vcxz(dot)co(dot)uk>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Attempt to re-archive existing WAL logs after restoring from backup
Date: 2007-05-31 04:58:26
Message-ID: 465E55F2.2020103@vcxz.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-hackers

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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message adey 2007-05-31 05:30:20 Re: High Avaliable in the PostgreSQL.
Previous Message Andrew Sullivan 2007-05-30 22:26:57 Re: High Avaliable in the PostgreSQL.

Browse pgsql-hackers by date

  From Date Subject
Next Message Zoltan Boszormenyi 2007-05-31 05:31:48 Re: New cast between inet/cidr and bytea
Previous Message OmniPay Company 2007-05-31 02:42:41 Job Proposal