X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 13133D9AF9 for ; Tue, 4 Oct 2005 13:04:05 -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 56910-07 for ; Tue, 4 Oct 2005 16:04:00 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 404EBDA054 for ; Tue, 4 Oct 2005 13:04:00 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.13.1/8.13.1) with ESMTP id j94G3xVR059409 for ; Tue, 4 Oct 2005 16:03:59 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.13.1/8.13.1/Submit) id j94FqEXN057159 for pgsql-admin@postgresql.org; Tue, 4 Oct 2005 15:52:14 GMT (envelope-from news) From: Gaetano Mendola X-Newsgroups: pgsql.admin Subject: Re: archive_command Date: Tue, 04 Oct 2005 17:51:58 +0200 Organization: Hub.Org Networking Services Lines: 45 Message-ID: <4342A51E.5030502@bigfoot.com> References: <20031115132118.V74587@holywar.net> <433AC059.1050300@musicrebellion.com> <433ACE02.3040208@musicrebellion.com> <1128071627.19345.256.camel@localhost.localdomain> <1128113968.4045.32.camel@localhost.localdomain> <1128246295.3717.76.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: Jeff Frost User-Agent: Thunderbird 1.4 (Windows/20050908) In-Reply-To: To: pgsql-admin@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=-2.577 required=5 tests=[ALL_TRUSTED=-2.82, AWL=0.243] X-Spam-Level: X-Archive-Number: 200510/59 X-Sequence-Number: 19131 Jeff Frost wrote: > On Sun, 2 Oct 2005, Simon Riggs wrote: > >> Probably the best idea is to backup the last WAL file for each timeline >> seen. Keep track of that, so when the current file changes you'll know >> which timeline you're on and stick to that from then on. Or more simply, >> put some notes with your program saying "if you ever use a complex >> recovery situation, make sure to clear all archive_status files for >> higher timeline ids before using this program". > > Tell me if you think this is the most reasonable way to determine the in > use WAL file: > > ls -rt $PGDATA/pg_xlog/ | grep -v "backup\|archive\|RECOVERY" | tail -1 > Look at this post I did last year: http://archives.postgresql.org/pgsql-admin/2005-06/msg00013.php in that messages there are two script that deliver remotelly the archive wall, and they store too last WAL in order to not loose the current WAL in case of crash. This was the function I used to find the WAL in use: function copy_last_wal { FILE=$( ls -t1p $PGXLOG | grep -v / | head -1 ) echo "Last Wal> " $FILE cp ${PGXLOG}/${FILE} ${PARTIAL}/${FILE}.tmp mv ${PARTIAL}/${FILE}.tmp ${PARTIAL}/${FILE}.partial find ${PARTIAL} -name *.partial | grep -v ${FILE} | xargs -i rm -fr {} } At that time Tom Lane agreed to provide some functions to ask the engine the name of WAL currently in use, dunno if in the new 8.1 something was done in order to help this process. Regards Gaetano Mendola