Обсуждение: Can't get pg_upgrade work for 8.4

Поиск
Список
Период
Сортировка

Can't get pg_upgrade work for 8.4

От
Alexander Fortin
Дата:
Hi folks.

I've been struggling a while with 9.1.2 pg_upgrade on Ubuntu 10.04.3,
but I can't find a way out so I've subscribed to this ML, I hope it's
the right place.

So, I've got an 8.4 (Ubuntu packaged) postgresql cluster that needs to
be upgraded to 9.1

I can't use the Ubuntu packaged v9.1.1 because of a bug with pg_upgrade
(cfr
http://postgresql.1045698.n5.nabble.com/Problem-with-pg-upgrade-9-0-gt-9-1-td4813453.html)

so I'm going with a compiled 9.1.2, but seems there's another problem,
but because of pg_ctl this time. This is what happens:

postgres@box:~/8.4/main$ /usr/local/postgresql-9.1.2/bin/pg_upgrade
--old-bindir=/usr/lib/postgresql/8.4/bin/
--new-bindir=/usr/local/postgresql-9.1.2/bin/ --check
--old-datadir=/var/lib/postgresql/8.4/main/
--new-datadir=/var/lib/postgresql/8.4/main/main9.1/ --link
--logfile=/tmp/logging_pgupgrade --old-port=5432 --new-port=15432 --verbose
Running in verbose mode
Performing Consistency Checks on Old Live Server
------------------------------------------------
Checking current, bin, and data directories                 ok
Checking cluster versions                                   ok
Checking database user is a superuser                       ok
Checking for prepared transactions                          ok
Checking for reg* system oid user data types                ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for large objects                                  ok
"/usr/local/postgresql-9.1.2/bin/pg_ctl" -w -l "/tmp/logging_pgupgrade"
-D "/var/lib/postgresql/8.4/main/main9.1" -o "-p 15432 -b" start >>
"/tmp/logging_pgupgrade" 2>&1
Checking for prepared transactions                          ok
Checking for presence of required libraries                 ok

*Clusters are compatible*
"/usr/local/postgresql-9.1.2/bin/pg_ctl" -w -l "/tmp/logging_pgupgrade"
-D "/var/lib/postgresql/8.4/main/main9.1"  stop >>
"/tmp/logging_pgupgrade" 2>&1

This works, but only if I previously started up the 8.4 cluster.

Than, I want to run it without the --check options. So I stop the 8.4
cluster (otherwise pg_upgrade will complain), and this is where I get stuck:

postgres@box:~/8.4/main$ /usr/local/postgresql-9.1.2/bin/pg_upgrade
--old-bindir=/usr/lib/postgresql/8.4/bin/
--new-bindir=/usr/local/postgresql-9.1.2/bin/
--old-datadir=/var/lib/postgresql/8.4/main/
--new-datadir=/var/lib/postgresql/8.4/main/main9.1/ --link
--logfile=/tmp/logging_pgupgrade --old-port=5432 --new-port=15432 --verbose
Running in verbose mode
Performing Consistency Checks
-----------------------------
Checking current, bin, and data directories                 ok
Checking cluster versions                                   ok
"/usr/lib/postgresql/8.4/bin/pg_ctl" -w -l "/tmp/logging_pgupgrade" -D
"/var/lib/postgresql/8.4/main" -o "-p 5432 -c autovacuum=off -c
autovacuum_freeze_max_age=2000000000" start >> "/tmp/logging_pgupgrade" 2>&1
There were problems executing "/usr/lib/postgresql/8.4/bin/pg_ctl" -w -l
"/tmp/logging_pgupgrade" -D "/var/lib/postgresql/8.4/main" -o "-p 5432
-c autovacuum=off -c autovacuum_freeze_max_age=2000000000" start >>
"/tmp/logging_pgupgrade" 2>&1

pg_ctl failed to start the old server
Failure, exiting


Now, the 8.4 cluster actually does get started by the above pg_ctl
command, but seems that the -w option is somehow broken (note that the
packaged Ubuntu postgresql 8.4 doesn't use pg_ctl but pg_ctlcluster
instead), causing pg_upgrade to fail.

Any suggestion on how to fix this? Thank you very much for you time,
best wishes

--
Alexander Fortin
http://about.me/alexanderfortin/

Re: Can't get pg_upgrade work for 8.4

От
Alexander Fortin
Дата:
Seems that the problem resides in the pg_ctl packaged with Ubuntu 10.04,
the only way we found to fix this was to recompile Postgresql 8.4.9 from
sources using the following patch, than instruct pg_upgrade (9.1.2) to
use the hand compiled pg_ctl instead of the original one (a raw symlink
did the job).

Here's the patch, maybe someone could need it.


*** pg_ctl.c.orig       2011-12-27 14:52:27.000000000 +0000
--- pg_ctl.c    2011-12-27 15:20:25.000000000 +0000
***************
*** 503,509 ****
          * probably timeout first
          */
         snprintf(connstr, sizeof(connstr),
!                        "dbname=postgres port=%s connect_timeout=5",
portstr);

         for (i = 0; i < wait_seconds; i++)
         {
--- 503,509 ----
          * probably timeout first
          */
         snprintf(connstr, sizeof(connstr),
!                        "dbname=postgres port=%s connect_timeout=5
host=localhost", portstr);

         for (i = 0; i < wait_seconds; i++)
         {


Happy new year!

--
Alexander Fortin
http://about.me/alexanderfortin/

Re: Can't get pg_upgrade work for 8.4

От
Bruce Momjian
Дата:
On Wed, Dec 28, 2011 at 03:38:26PM +0100, Alexander Fortin wrote:
> Seems that the problem resides in the pg_ctl packaged with Ubuntu
> 10.04, the only way we found to fix this was to recompile Postgresql
> 8.4.9 from sources using the following patch, than instruct
> pg_upgrade (9.1.2) to use the hand compiled pg_ctl instead of the
> original one (a raw symlink did the job).
>
> Here's the patch, maybe someone could need it.
>
>
> *** pg_ctl.c.orig       2011-12-27 14:52:27.000000000 +0000
> --- pg_ctl.c    2011-12-27 15:20:25.000000000 +0000
> ***************
> *** 503,509 ****
>          * probably timeout first
>          */
>         snprintf(connstr, sizeof(connstr),
> !                        "dbname=postgres port=%s
> connect_timeout=5", portstr);
>
>         for (i = 0; i < wait_seconds; i++)
>         {
> --- 503,509 ----
>          * probably timeout first
>          */
>         snprintf(connstr, sizeof(connstr),
> !                        "dbname=postgres port=%s connect_timeout=5
> host=localhost", portstr);
>
>         for (i = 0; i < wait_seconds; i++)
>         {

Sorry for the late reply.  Did you have a PGHOST variable set to
something?  That might have caused the problem.  Your change basically
forces it to do a tcp connection to the local database --- the default
is to do a unix-domain socket/local connection to the database.

Glad you finally got it working.

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

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