I wrote:
> A possibly more reliable interlock would involve having the postmaster
> probe during normal startup to see if there is already an archived WAL
> segment for what it thinks is the current segment.

Another and simpler way is to recommend that people use archive_command
strings that won't overwrite an existing archive file.

For instance instead of showing the example
archive_command = 'cp %p /mnt/server/archivedir/%f'
we could show
archive_command = 'test ! -f /mnt/server/archivedir/%f && cp %p 
/mnt/server/archivedir/%f'
or on some machines
archive_command = 'cp -i %p /mnt/server/archivedir/%f </dev/null'

One tricky point is to make sure that the command will return nonzero
status if the target exists.  In some quick testing I found that
the "cp -i" method doesn't have portable behavior on this point.
I think that the "test" method is portable across Unixen, but no idea
what to do on Windows.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to