postgres index contains "unexpected zero page at block" exceptions

Viewed 6489

I have following errors in pg_log file several thousand times. How to resolve them.

index "meeting_pkey" contains unexpected zero page at block 410.Please REINDEX it.
index "faultevent_props_pkey" contains unexpected zero page at block 37290.
index "faultevent_pkey" contains unexpected zero page at block 1704
3 Answers

The cause of the issue is due to bad index pages and its unable to read it.

Reindex the problematic index to overcome the issue.

 Reindex index <schema_name>.<index_name>;

Here you have some hits.

Your database is corrupt.

Try to run pg_dumpall to get a logical dump of the database.

If that fails, buy support from somebody who can salvage data from corrupted databases.

If it succeeds:

  • Check the hardware, particularly storage and RAM.
  • Once you are certain the hardware is ok, install the latest patch update for your PostgreSQL version.
  • Create a new database cluster with initdb.
  • Restore the dump into the new cluster.

Did you have crashes recently?
Did you test if your storage handles fsync requests properly?
Do you have any dangerous settings like fsync = off?

I ran into this issue and after a lot of reading I decided to do a complete DB reindex:

reindex DATABASE <DATABASE NAME>

and it solved the issue for me. Hope this helps you.

Related