From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Abhijit Gharami <abhijitgharami@gmail.com>
To: PostgreSQL mailing lists <pgsql-general@postgresql.org>
Subject: Re: root page 3 of index "pg_class_oid_index" has level 0, expected 1
Date: Thu, 14 Nov 2019 08:26:48 +0100
Message-ID: <d7fb945420c8cbe5483d4823c1e61ffa3e506cfe.camel@cybertec.at> (raw)
In-Reply-To: <CAA5_DuAAVjcm0=JFVB2os_aDOiKZtnGWszk29t4CpeDdRbVx8w@mail.gmail.com>
References: <CAA5_DuAAVjcm0=JFVB2os_aDOiKZtnGWszk29t4CpeDdRbVx8w@mail.gmail.com>
Abhijit Gharami wrote:
> During major version upgrade from PostgreSQL v9.4 to v9.6 I facing following error:
>
> Performing Consistency Checks
> -----------------------------
> Checking cluster versions ok
>
> connection to database failed: FATAL: root page 3 of index "pg_class_oid_index" has level 0, expected 1
>
>
> could not connect to old postmaster started with the command:
> "/postgresql94/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "/data/directory/postgresql" -o "-p 5432 -b -c listen_addresses='' -c unix_socket_permissions=0700 -c
> unix_socket_directories='/home/postgresql_user'" start
> Failure, exiting
>
>
> Again, I was trying to take the pg_dumpall of the same database cluster(PostgreSQL v9.4) and it failed with error:
> pg_dump: [archiver (db)] connection to database "template1" failed: FATAL: root page 3 of index "pg_class_oid_index" has level 0, expected 1
> pg_dumpall: pg_dump failed on database "template1", exiting
>
> Please suggest how should I proceed with major version upgrade in this case.
You are experiencing catalog corruption.
Try stopping the cluster and starting it with
postgres -P -D /path/to/data/dir
Then connect and run
REINDEX TABLE pg_catalog.pg_class;
That should fix the corrupted index.
If you have data corruption, you shouldn't use pg_upgrade to upgrade.
pg_dumpall / psql is the way to go.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: laurenz.albe@cybertec.at, abhijitgharami@gmail.com
Subject: Re: root page 3 of index "pg_class_oid_index" has level 0, expected 1
In-Reply-To: <d7fb945420c8cbe5483d4823c1e61ffa3e506cfe.camel@cybertec.at>
References: <CAA5_DuAAVjcm0=JFVB2os_aDOiKZtnGWszk29t4CpeDdRbVx8w@mail.gmail.com> <d7fb945420c8cbe5483d4823c1e61ffa3e506cfe.camel@cybertec.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox