Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id A3E109FB88D for ; Thu, 31 May 2007 01:58:33 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 08434-08 for ; Thu, 31 May 2007 01:58:29 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 599839FB735 for ; Thu, 31 May 2007 01:58:30 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from out2.smtp.messagingengine.com (out2.smtp.messagingengine.com [66.111.4.26]) by svr4.postgresql.org (Postfix) with ESMTP id ABBA85AF03A for ; Thu, 31 May 2007 04:58:29 +0000 (GMT) Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id A4AE122B03B for ; Thu, 31 May 2007 00:58:28 -0400 (EDT) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute1.internal (MEProxy); Thu, 31 May 2007 00:58:28 -0400 X-Sasl-enc: Zss/56VL7x/1yvPRgo0Z3y6hdI44XOMbyt5hq72psUwZ 1180587508 Received: from [62.3.213.205] (unknown [62.3.213.205]) by mail.messagingengine.com (Postfix) with ESMTP id 00E9D23642 for ; Thu, 31 May 2007 00:58:27 -0400 (EDT) Message-ID: <465E55F2.2020103@vcxz.co.uk> Date: Thu, 31 May 2007 05:58:26 +0100 From: Jon Colverson User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.3) Gecko/20070326 Thunderbird/2.0.0.0 Mnenhy/0.7.5.0 MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Re: Attempt to re-archive existing WAL logs after restoring from backup References: <465BA7C5.6080400@vcxz.co.uk> In-Reply-To: <465BA7C5.6080400@vcxz.co.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/326 X-Sequence-Number: 25646 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