public inbox for [email protected]  
help / color / mirror / Atom feed
wal shipping/pg_standby docs patch
3+ messages / 2 participants
[nested] [flat]

* wal shipping/pg_standby docs patch
@ 2009-03-25 19:20 Frank Wiles <[email protected]>
  2009-03-26 02:04 ` Re: wal shipping/pg_standby docs patch Tom Lane <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Frank Wiles @ 2009-03-25 19:20 UTC (permalink / raw)
  To: pgsql-docs

Hello,

It has been awhile since I setup a warm standby server, so I dutifully
followed the documentation.  However, the documentation specifically
suggests using 'cp -i' as the archive command.  Granted, it does say
that it is only a suggestion and not a recommendation, but does
specifically mention it for Linux.

Wasn't three days before I was bitten by transferring a WAL file
before it was fully copied into the archive location.

Attached is a patch that makes the suggestion be 'rsync -avr' in both
backup.sgml and pg_standby.sgml.

Thanks!

-- 
Frank Wiles
Revolution Systems | http://www.revsys.com/
[email protected]   | (800) 647-6298


Attachments:

  [text/x-diff] rsync-doc.patch (1.4K, 2-rsync-doc.patch)
  download | inline diff:
diff -ur postgresql-snapshot/doc/src/sgml/backup.sgml my-postgresql/doc/src/sgml/backup.sgml
--- postgresql-snapshot/doc/src/sgml/backup.sgml	2009-03-05 13:50:03.000000000 -0600
+++ my-postgresql/doc/src/sgml/backup.sgml	2009-03-25 13:35:24.000000000 -0500
@@ -564,7 +564,7 @@
 </programlisting>
     which will copy archivable WAL segments to the directory
     <filename>/mnt/server/archivedir</>.  (This is an example, not a
-    recommendation, and might not work on all platforms.)  After the
+    recommendation, and might not work on all platforms. It is highly recommend you use a tool that does atomic copies such as <programlisting>rsync -arv %p...</programlisting>)  After the
     <literal>%p</> and <literal>%f</> parameters have been replaced,
     the actual command executed might look like this:
 <programlisting>
diff -ur postgresql-snapshot/doc/src/sgml/pgstandby.sgml my-postgresql/doc/src/sgml/pgstandby.sgml
--- postgresql-snapshot/doc/src/sgml/pgstandby.sgml	2009-02-27 03:30:21.000000000 -0600
+++ my-postgresql/doc/src/sgml/pgstandby.sgml	2009-03-25 13:27:42.000000000 -0500
@@ -207,7 +207,7 @@
   <para>On Linux or Unix systems, you might use:</para>
 
   <programlisting>
-archive_command = 'cp %p .../archive/%f'
+archive_command = 'rsync -arz %p .../archive/%f'
 
 restore_command = 'pg_standby -l -d -s 2 -t /tmp/pgsql.trigger.5442 .../archive %f %p %r 2>>standby.log'
   </programlisting>


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: wal shipping/pg_standby docs patch
  2009-03-25 19:20 wal shipping/pg_standby docs patch Frank Wiles <[email protected]>
@ 2009-03-26 02:04 ` Tom Lane <[email protected]>
  2009-03-26 16:08   ` Re: wal shipping/pg_standby docs patch Frank Wiles <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2009-03-26 02:04 UTC (permalink / raw)
  To: Frank Wiles <[email protected]>; +Cc: pgsql-docs

Frank Wiles <[email protected]> writes:
> Attached is a patch that makes the suggestion be 'rsync -avr' in both
> backup.sgml and pg_standby.sgml.

Seems to me the first question to ask is exactly why you got "bit" by
cp.  I doubt that rsync will provide a magic answer.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: wal shipping/pg_standby docs patch
  2009-03-25 19:20 wal shipping/pg_standby docs patch Frank Wiles <[email protected]>
  2009-03-26 02:04 ` Re: wal shipping/pg_standby docs patch Tom Lane <[email protected]>
@ 2009-03-26 16:08   ` Frank Wiles <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Frank Wiles @ 2009-03-26 16:08 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; +Cc: pgsql-docs

On Wed, Mar 25, 2009 at 9:04 PM, Tom Lane <[email protected]> wrote:
> Frank Wiles <[email protected]> writes:
>> Attached is a patch that makes the suggestion be 'rsync -avr' in both
>> backup.sgml and pg_standby.sgml.
>
> Seems to me the first question to ask is exactly why you got "bit" by
> cp.  I doubt that rsync will provide a magic answer.
>
>                        regards, tom lane

Hi Tom,

Using the example in the docs in both places suggests using cp to copy
to your archive location, which isn't atomic.  This leaves open the
possibility of transferring to your warm standby server part of a WAL
file.  In my case I was using rsync in cron to pull from the "master"
onto the warm standby server.  Ran fine for 3 days, then I transferred
a 14MB and a 8.2MB WAL file.  Basically being unlucky and transferring
it at just the wrong time.

This obviously hosed the warm standby and I had to go through the
whole backup procedure again.  Using rsync, as it is atomic, prevents
this.

-- 
Frank Wiles
Revolution Systems | http://www.revsys.com/
[email protected]   | (800) 647-6298




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2009-03-26 16:08 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-03-25 19:20 wal shipping/pg_standby docs patch Frank Wiles <[email protected]>
2009-03-26 02:04 ` Tom Lane <[email protected]>
2009-03-26 16:08   ` Frank Wiles <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox