On 1/17/07, Doug Knight <dknight@wsi.com> wrote:
> I confirm that I am seeing the exact same characteristic. Could you post
> your rotating script?
note: this is still a work in progress, the crude but effective sleep
5 is due to be replaced with a lock/fifo and there catch_wal.sh needs
to be rewritten a bit. truncate is a C one-liner I wrote which does a
ftruncate.
*** primary: ***
archive_command = '/home/postgres/send_wal.sh %p %f'
*** send_wal.sh: ***
!/bin/bash
echo "archiving: $2" >> ~/send_wal.log
cat $1 <(echo "placeholder") <(echo $2) | nc $STANDBY 1234 && sleep 5
*** secondary: ***
restore_command = 'pg_standby -m -w0 -t/raid/pitr/kill /raid/pitr %f %p'
*** catch_wal.sh ***
!/bin/bash
WALDIR=/raid/pitr
rm -f $WALDIR/*.old
rm -f $WALDIR/*.older
> $WALDIR/tmp.older
> $WALDIR/tmp.old
while true;
do
tmpfile=`mktemp`
nc -l 1234 > $tmpfile || { echo "FATAL: nc listen failed"; exit 1; }
chown postgres:postgres $tmpfile
file_name=`tail -1 $tmpfile`
./truncate $tmpfile 16777216
rm -f $WALDIR/*.older
for i in `ls $WALDIR/*.old`; do mv $i $WALDIR/`basename $i .old`.older; done
mv $tmpfile $WALDIR/$file_name.old
cp --preserve=ownership $WALDIR/$file_name.old $WALDIR/$file_name
echo "LOG: caught file: $file_name"
done