Re: pg_upgrade and rsync

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Andres Freund <andres(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Josh Berkus <josh(at)agliodbs(dot)com>
Subject: Re: pg_upgrade and rsync
Date: 2015-01-27 14:36:58
Message-ID: 20150127143658.GH3854@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

* Robert Haas (robertmhaas(at)gmail(dot)com) wrote:
> On Sat, Jan 24, 2015 at 10:04 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> > On Fri, Jan 23, 2015 at 02:34:36PM -0500, Stephen Frost wrote:
> >> > > You'd have to replace the existing data directory on the master to do
> >> > > that, which pg_upgrade was designed specifically to not do, in case
> >> > > things went poorly.
> >> >
> >> > Why? Just rsync the new data directory onto the old directory on the
> >> > standbys. That's fine and simple.
> >>
> >> That still doesn't address the need to use --size-only, it would just
> >> mean that you don't need to use -H. If anything the -H part is the
> >> aspect which worries me the least about this approach.
> >
> > I can now confirm that it works, just as Stephen said. I was able to
> > upgrade a standby cluster that contained the regression database, and
> > the pg_dump output was perfect.
> >
> > I am attaching doc instruction that I will add to all branches as soon
> > as someone else confirms my results. You will need to use rsync
> > --itemize-changes to see the hard links being created, e.g.:
> >
> > hf+++++++++ pgsql/data/base/16415/28188 => pgsql.old/data/base/16384/28188
>
> My rsync manual page (on two different systems) mentions nothing about
> remote_dir, so I'd be quite unable to follow your proposed directions.

The example listed works, but only when it's a local rsync:

rsync --archive --hard-links --size-only old_dir new_dir remote_dir

Perhaps a better example (or additional one) would be with a remote
rsync, including clarification of old and new dir, like so:

(run in /var/lib/postgresql)
rsync --archive --hard-links --size-only \
9.3/main \
9.4/main \
server:/var/lib/postgresql/

Note that 9.3/main and 9.4/main are two source directories for rsync to
copy over, while server:/var/lib/postgresql/ is a remote destination
directory. The above directories match a default Debian/Ubuntu install.

Thanks!

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-01-27 14:50:59 Re: pg_upgrade and rsync
Previous Message Andres Freund 2015-01-27 14:27:13 GetLockConflicts() and thus recovery conflicts seem pretty broken