Re: [GENERAL] pg_upgrade fails, "mismatch of relation OID" - 9.1.9 to 9.2.4

From: "Evan D(dot) Hoffman" <evandhoffman(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Igor Neyman <ineyman(at)perceptron(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [GENERAL] pg_upgrade fails, "mismatch of relation OID" - 9.1.9 to 9.2.4
Date: 2013-05-09 14:20:12
Message-ID: CABRB-Lur114=SnF4EZegfS7FmtfJgZ6eCKd_4U=Y7BPoMegnuQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

From the 9.1 cluster (port 5432):

db=# SELECT relname, relfilenode, relkind from pg_class where oid = 2938685;
relname | relfilenode | relkind
-----------------------+-------------+---------
substitutionlist_pkey | 21446253 | i
(1 row)

db=#

From the 9.2 cluster (port 5433):

db=# SELECT relname from pg_class where oid = 299721;
relname
---------
(0 rows)

db=#

Assuming the relfilenode would be the filename on disk, it exists in
the 9.1 DB but not in the 9.2:

[root(at)dev-db2 16407]# ls -lh /var/lib/pgsql/9.1/data/base/16407/21446253
-rw------- 1 postgres postgres 16K May 7 12:04
/var/lib/pgsql/9.1/data/base/16407/21446253
[root(at)dev-db2 16407]# ls -lh /var/lib/pgsql/9.2/data/base/16407/21446253
ls: cannot access /var/lib/pgsql/9.2/data/base/16407/21446253: No such
file or directory
[root(at)dev-db2 16407]#

On Wed, May 8, 2013 at 5:35 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> On Wed, May 8, 2013 at 02:27:18PM -0400, Evan D. Hoffman wrote:
>> If you want to start the old cluster, you will need to remove
>> the ".old" suffix from /var/lib/pgsql/9.1/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
>> /var/lib/pgsql/9.1/data/base/16406/3016054
>> Mismatch of relation OID in database "dbname": old OID 2938685, new OID 299721
>> Failure, exiting
>
> [ Moved to hackers ]
>
> OK, that is odd. We preserve old/new OIDs, (not relfilenode, as someone
> suggested in this thread); FYI:
>
> * FYI, while pg_class.oid and pg_class.relfilenode are initially the same
> * in a cluster, but they can diverge due to CLUSTER, REINDEX, or VACUUM
> * FULL. The new cluster will have matching pg_class.oid and
> * pg_class.relfilenode values and be based on the old oid value. This can
> * cause the old and new pg_class.relfilenode values to differ. In summary,
> * old and new pg_class.oid and new pg_class.relfilenode will have the
> * same value, and old pg_class.relfilenode might differ.
>
> The problem reported is that pg_dump was not able to preserve the
> old/new oids between clusters. Can you get the answer for this query on
> the old cluster:
>
> SELECT relname from pg_class where oid = 2938685;
>
> and on the new cluster, assuming you used 'copy' mode so you can start
> the old/new clusters indepdendently:
>
> SELECT relname from pg_class where oid = 299721;
>
> I think we will find that there is something in pg_dump related to this
> table that isn't preserving the oids.
>
> --
> Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
> EnterpriseDB http://enterprisedb.com
>
> + It's impossible for everything to be true. +

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2013-05-09 14:45:57 Re: [GENERAL] pg_upgrade fails, "mismatch of relation OID" - 9.1.9 to 9.2.4
Previous Message Steve Rogerson 2013-05-09 13:49:02 Re: Composite fields and the query planner

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2013-05-09 14:45:57 Re: [GENERAL] pg_upgrade fails, "mismatch of relation OID" - 9.1.9 to 9.2.4
Previous Message Peter Eisentraut 2013-05-09 14:11:09 Re: improving PL/Python builds on OS X