3

My pg_upgrade command failed. During the upgrade it told me, that if things were failing after a curtain point (which they did) Then I should:

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

But what does this mean?

EDIT

$> /usr/lib/postgresql/9.3/bin/pg_upgrade -b /usr/lib/postgresql/9.2/bin -B /usr/lib/postgresql/9.3/bin -d /var/lib/postgresql/9.2/main/ -D /var/lib/postgresql/9.3/main/ -j 6 -O "-c config_file=/etc/postgresql/9.3/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.2/main/postgresql.conf"
Performing Consistency Checks
-----------------------------
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 dump of global objects                             ok
Creating dump of database schemas
                                                            ok
Checking for presence of required libraries                 ok
Checking database user is a superuser                       ok
Checking for prepared transactions                          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 files from new pg_clog                             ok
Copying old pg_clog to new server                           ok
Setting next transaction ID for new cluster                 ok
Setting oldest multixact ID on new cluster                  ok
Resetting WAL archives                                      ok
Setting frozenxid counters in new cluster                   ok
Restoring global objects in the new cluster                 ok
Adding support functions to new cluster                     ok
Restoring database schemas in the new cluster
  template1                                                 
*failure*

Consult the last few lines of "pg_upgrade_dump_27132.log" for
the probable cause of the failure.
Failure, exiting

child worker exited abnormally: Success
Failure, exiting

*failure*
Consult the last few lines of "pg_upgrade_server.log" for
the probable cause of the failure.

Log:

2014-02-26 01:05:58 CET ERROR:  function pg_catalog._final_mode(anyarray) does not exist
2014-02-26 01:05:58 CET STATEMENT:  CREATE AGGREGATE "mode"("anyelement") (
        SFUNC = "array_append",
        STYPE = "anyarray",
        INITCOND = '{}',
        FINALFUNC = "pg_catalog"."_final_mode"
    );
  • Please show the full pg_upgrade log. Do you have backups from before the upgrade? – Craig Ringer Feb 26 '14 at 0:31
  • Done, Thanks, What command exactly should I run? – Niels Kristian Feb 26 '14 at 0:33
  • i'm NOT using the "link"-mode – Niels Kristian Feb 26 '14 at 0:34
  • OK, and what's in the last few lines of pg_upgrade_dump_27132.log and pg_upgrade_server.log ? – Craig Ringer Feb 26 '14 at 0:40
  • There's no PostgreSQL function named _final_mode. Did you create it, and do so in pg_catalog? Or were you running a patched PostgreSQL? – Craig Ringer Feb 26 '14 at 6:58
2

The error means that the failed upgrade has left /var/lib/postgresql/9.3/main/ in an unusable state, broken and half upgraded. To attempt to upgrade again you must first remove it, then re-create it by running initdb like you did to create it the first time.

Look at pg_upgrade_dump_27132.log and pg_upgrade_server.log to see why the upgrade failed. Re-running it without changing anything is not likely to make any difference.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.