Re: [PATCHES] pg_standby

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Doug Knight" <dknight(at)wsi(dot)com>
Cc: "Simon Riggs" <simon(at)2ndquadrant(dot)com>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [PATCHES] pg_standby
Date: 2007-01-17 15:31:25
Message-ID: b42b73150701170731o3c266607h5a7a33e31426dd80@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On 1/17/07, Doug Knight <dknight(at)wsi(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-01-17 15:35:29 Re: Idea for fixing the Windows fsync problem
Previous Message Doug Knight 2007-01-17 15:10:00 Re: [PATCHES] pg_standby

Browse pgsql-patches by date

  From Date Subject
Next Message Merlin Moncure 2007-01-17 16:03:24 Re: [PATCHES] pg_standby
Previous Message Doug Knight 2007-01-17 15:10:00 Re: [PATCHES] pg_standby