X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 301FCD1B1AE for ; Mon, 19 Jul 2004 18:24:18 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04305-02 for ; Mon, 19 Jul 2004 21:24:11 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 6A33ED1B19A for ; Mon, 19 Jul 2004 18:24:09 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i6JLO6sA029940; Mon, 19 Jul 2004 17:24:06 -0400 (EDT) To: Bruce Momjian Cc: Simon Riggs , markw@osdl.org, kn@mgnet.de, pgsql-patches@postgresql.org Subject: Re: [HACKERS] Point in Time Recovery In-reply-to: <200407192024.i6JKOrO16297@candle.pha.pa.us> References: <200407192024.i6JKOrO16297@candle.pha.pa.us> Comments: In-reply-to Bruce Momjian message dated "Mon, 19 Jul 2004 16:24:52 -0400" Date: Mon, 19 Jul 2004 17:24:06 -0400 Message-ID: <29939.1090272246@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/308 X-Sequence-Number: 11978 Bruce Momjian writes: > we need to check to see which one has a WAL eof-of-segment marker (we > have on of those, right?). No, we don't. > I think I see a solution. We are going to create a file during backup so > we know the wal offsets and xids. If we see that file, we know either > we have a restore of a backup or they currently running a backup. ... or the last backup attempt failed, but they forgot to remove the file it left. Or we are doing crash recovery after the system lost power while a backup was running. Or half a dozen other obvious scenarios. > If we tell them not to restore while a backup is running (seems pretty > obvious) we can then delete pg_xlog when the backup wal offset file > exists. In other cases, we know the WAL files are valid to use. We're not deleting pg_xlog, period. IMHO it's too dangerous even to have such a function in the code. My original suggestion was to *replace* individual xlog files with data extracted from archive, and only after determining that the archive indeed has a copy of that particular file (and we can fetch it). This at least has a fighting chance of not losing information. Wiping pg_xlog in toto on the basis of a guess about the system status is just a form of russian roulette. Sooner or later you will wipe some xlog files that you can't get back from archive. regards, tom lane