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 ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your message can get through to the mailing list cleanly