Discussion:
[ADMIN] Can't get pg_upgrade work for 8.4
(too old to reply)
Alexander Fortin
2011-12-20 15:11:23 UTC
Permalink
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:

***@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:

***@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/
--
Sent via pgsql-admin mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Alexander Fortin
2011-12-28 14:38:26 UTC
Permalink
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/
--
Sent via pgsql-admin mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Bruce Momjian
2012-01-19 22:12:02 UTC
Permalink
Post by 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++)
{
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 <***@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +
--
Sent via pgsql-admin mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Loading...