HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Pg_upgrade failed - what does "re-initdb" mean?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
initdbwhatmeanpg_upgradedoesfailed

Problem

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

Solution

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.

Context

StackExchange Database Administrators Q#59657, answer score: 3

Revisions (0)

No revisions yet.