Skip site navigation (1) Skip section navigation (2)

Re: pg_upgrade --logfile option documentation

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>,Peter Eisentraut <peter_e(at)gmx(dot)net>,Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_upgrade --logfile option documentation
Date: 2012-02-29 02:45:41
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Tue, Feb 28, 2012 at 02:15:30PM -0500, Bruce Momjian wrote:
> On Tue, Feb 28, 2012 at 01:24:45PM -0500, Robert Haas wrote:
> > > Running this script will delete the old cluster's data files:
> > >    /usr/local/pgdev/pg_upgrade/
> > 
> > I think you should rename the old control file just before the step
> > that says "linking user relation files".  That's the point after which
> > it becomes unsafe to start the old cluster, right?
> Yes, it is true that that is the danger point, and also it is much less
> likely to fail at that point --- it usually happens during the schema
> creation.  I would have to add some more conditional wording without
> clearly stating if the old suffix is present.

OK, I have implemented both Roberts and Àlvaro's ideas in my patch. 
I only add the .old suffix to pg_controldata when link mode is used, and
I now do it after the schema has been created (the most common failure
case for pg_upgrade), and just before we actually link files --- both
very good ideas.

Patch attached;  new pg_upgrade output with link mode below.


Performing Consistency Checks
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
Creating catalog dump                                       ok
Checking for prepared transactions                          ok
Checking for presence of required libraries                 ok

If pg_upgrade fails after this point, you must re-initdb the
new cluster before continuing.

Performing Upgrade
Analyzing all rows in the new cluster                       ok
Freezing all rows on the new cluster                        ok
Deleting new commit clogs                                   ok
Copying old commit clogs to new server                      ok
Setting next transaction ID for new cluster                 ok
Resetting WAL archives                                      ok
Setting frozenxid counters in new cluster                   ok
Creating databases in the new cluster                       ok
Adding support functions to new cluster                     ok
Restoring database schema to new cluster                    ok
Removing support functions from new cluster                 ok
Adding ".old" suffix to old global/pg_control               ok

If you want to start the old cluster, you will need to remove
the ".old" suffix from /u/pgsql.old/data/global/pg_control.old.
Because "link" mode was used, the old cluster cannot be safely
started once the new cluster has been started.

Linking user relation files
Setting next OID for new cluster                            ok
Creating script to delete old cluster                       ok

Upgrade complete
Optimizer statistics are not transferred by pg_upgrade so
consider running:
    vacuumdb --all --analyze-only
on the newly-upgraded cluster.

Running this script will delete the old cluster's data files:

  Bruce Momjian  <bruce(at)momjian(dot)us>

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

Attachment: pg_upgrade.diff
Description: text/x-diff (9.4 KB)

In response to


pgsql-hackers by date

Next:From: Alvaro HerreraDate: 2012-02-29 03:28:14
Subject: Re: a typo in json.h
Previous:From: Haifeng LiuDate: 2012-02-29 02:31:26
Subject: a typo in json.h

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group