Skip site navigation (1) Skip section navigation (2)

backup WAL files,

From: "Sebastian Reitenbach" <sebastia(at)l00-bugdead-prods(dot)de>
To: pgsql-admin(at)postgresql(dot)org
Subject: backup WAL files,
Date: 2008-01-15 09:44:28
Message-ID: 20080115094428.D7C963AA8A@smtp.l00-bugdead-prods.de (view raw or flat)
Thread:
Lists: pgsql-admin
Hi,

I use a script like the example below to generate a list of the WAL files 
that have to be saved by the backup job. I take the the names of the first 
and last WAL files from the backup HISTORYFILE generated by 
pg_start_backup() and pg_stop_backup(). The names of the WAL files between 
the first and the last I calculate the following way:

                HISTORYFILE=`find ${ARCHIVEPATH} -name "*.backup" -exec 
grep -l "backup-${DATABASE}-${NOW}"  {} \;`
                FIRSTWALFILE=`grep "START WAL LOCATION" ${HISTORYFILE}  | 
awk '{print $6} ' | sed -e 's/)$//g'`
                LASTWALFILE=`grep "STOP WAL LOCATION" ${HISTORYFILE} | 
awk '{print $6} ' | sed -e 's/)$//g'`
                echo FIRSTWALFILE=$FIRSTWALFILE
                echo LASTWALFILE=$LASTWALFILE

FILE_PREFIX=`echo $FIRSTWALFILE | cut -c 1-15`
FIRST_SUFFIX=`echo $FIRSTWALFILE | cut -c 16-`
LAST_SUFFIX=`echo $LASTWALFILE | cut -c 16-`

CNTA=`echo "obase=10;ibase=16; $FIRST_SUFFIX" | bc`
CNTE=`echo "obase=10;ibase=16; $LAST_SUFFIX" | bc`
echo $CNTA $CNTE

while [ $CNTA -le $CNTE ];do
        echo ${FILE_PREFIX}${FIRST_SUFFIX} # >> outfile
        FIRST_SUFFIX=`echo "obase=16;ibase=16; ${FIRST_SUFFIX} + 1" | bc`
        CNTA=$(($CNTA+1))
done


The WAL files have names like this:
00000001000000010000003C

I am wonder what the meaning of the two 1 in the filename is? Are the WAL 
file names counted up to FFFFFFFFFFFFFFFFFFFFFFFFF ?
Then I'll run into problems anyways as these int number are too large to be 
handled by bash.

any insight is highly appreciated.

kind regards
Sebastian


Responses

pgsql-admin by date

Next:From: Scott MarloweDate: 2008-01-15 15:19:46
Subject: Re: Pg_statio_user_tables view does not get populated
Previous:From: Thomas MarkusDate: 2008-01-15 09:33:32
Subject: update performance 8.1.4

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group