Re: pg_upgrade - add config directory setting

Bruce Momjian <bruce@momjian.us>

From: Bruce Momjian <bruce@momjian.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Steve Crawford <scrawford@pinpointresearch.com>, "Mr. Aaron W. Swenson" <titanofold@gentoo.org>, pgsql-hackers@postgresql.org
Date: 2011-10-08T14:31:14Z
Lists: pgsql-hackers

Attachments

Bruce Momjian wrote:
> OK, I have modified the postmaster in PG 9.2 to allow output of the data
> directory, and modified pg_ctl to use that, so starting in PG 9.2 pg_ctl
> will work cleanly for config-only directories.
> 
> I will now work on pg_upgrade to also use the new flag to find the data
> directory from a config-only install.  However, this is only available
> in PG 9.2, and it will only be in PG 9.3 that you can hope to use this
> feature (if old is PG 9.2 or later).  I am afraid the symlink hack will
> have to be used for several more years, and if you are supporting
> upgrades from pre-9.2, perhaps forever.
> 
> I did find that it is possible to use pg_ctl -w start on a config-only
> install using this trick:
> 
>   su -l postgres \
>     -c "env PGPORT=\"5432\" /usr/lib/postgresql-9.1/bin/pg_ctl start -w \
>         -t 60 -s -D /var/lib/postgresql/9.1/data/ \
>          -o '-D /etc/postgresql-9.1/ \
>             --data-directory=/var/lib/postgresql/9.1/data/ \
>             --silent-mode=true'"
> 
> Unfortunately pg_upgrade doesn't support the -o option which would make
> this possible for pg_upgrade.
> 
> One idea would be to add -o/-O options to pg_upgrade 9.2 to allow this
> to work even with old installs, but frankly, this is so confusing I am
> not sure we want to encourage people to do things like this.  Of course,
> the symlink hack is even worse, so maybe there is some merit to this.

OK, the attached patch adds -o/-O options to pg_upgrade to mimick pg_ctl
-o, and documents the 'Gentoo method' for allowing pg_upgrade to handle
pre-9.2 upgrades for config-only installs.  I think this closes the
issue, with no backpatching required for it to work for new PG 9.2. 
Users will have to continue using the symlink method for new PG 9.1.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +