Discussion:
[ADMIN] DB corruption.
(too old to reply)
Jesper Krogh
2011-10-09 06:40:08 UTC
Permalink
Hi.

I have got a corrupt db.. most likely due to an xfs bug..

pg_dump: SQL command failed
pg_dump: Error message from server: ERROR: invalid page header in block
14174944 of relation base/16385/58318948

Can I somehow get pg_dump to "ignore" that block and dump everything else?

Jesper
--
Sent via pgsql-admin mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Lukasz Brodziak
2011-10-09 08:49:28 UTC
Permalink
Hi,
I would go with cluster on the relation with invalid page header and try to
dump the db again. If you have an older dump of the db and data in corrupted
table did not change since turnieju You may try to restore the table from it
and run pg_dump again.
I don't know If one can ommit a page during dump You can exclude whole
table.
Hope this helps You.
Regards
Luke
Post by Jesper Krogh
Hi.
I have got a corrupt db.. most likely due to an xfs bug..
pg_dump: SQL command failed
pg_dump: Error message from server: ERROR: invalid page header in block
14174944 of relation base/16385/58318948
Can I somehow get pg_dump to "ignore" that block and dump everything else?
Jesper
--
http://www.postgresql.org/**mailpref/pgsql-admin<http://www.postgresql.org/mailpref/pgsql-admin>
Ray Stell
2011-10-09 13:17:11 UTC
Permalink
Post by Lukasz Brodziak
Hi,
I would go with cluster on the relation with invalid page header and try to
forgive me, what does "cluster on the relation" mean?
--
Sent via pgsql-admin mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Lukasz Brodziak
2011-10-09 15:04:17 UTC
Permalink
It was a shortcut I meant clustering the index on the corrupted table with
CLUSTER indexname ON tablename.
Post by Ray Stell
Post by Lukasz Brodziak
Hi,
I would go with cluster on the relation with invalid page header and try
to
forgive me, what does "cluster on the relation" mean?
Kevin Grittner
2011-10-09 12:31:40 UTC
Permalink
Post by Lukasz Brodziak
I would go with cluster on the relation with invalid page header
Or, if you don't have the free disk space or the time for that, you
could drop and recreate the index. You could even do that with no
down time or long blocks by using CREATE INDEX CONCURRENTLY.

-Kevin
--
Sent via pgsql-admin mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Tom Lane
2011-10-09 15:41:57 UTC
Permalink
Post by Jesper Krogh
I have got a corrupt db.. most likely due to an xfs bug..
pg_dump: SQL command failed
pg_dump: Error message from server: ERROR: invalid page header in block
14174944 of relation base/16385/58318948
Can I somehow get pg_dump to "ignore" that block and dump everything else?
The traditional solution is to zero out the bad block, eg using dd from
/dev/zero. It's easy to zero more than you intended, so practicing on a
scratch copy of the table is recommended.

But first you should check what kind of relation that is. If it's an
index, you could just REINDEX it instead.

regards, tom lane
--
Sent via pgsql-admin mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Jesper Krogh
2011-10-09 17:49:16 UTC
Permalink
Post by Tom Lane
Post by Jesper Krogh
I have got a corrupt db.. most likely due to an xfs bug..
pg_dump: SQL command failed
pg_dump: Error message from server: ERROR: invalid page header in block
14174944 of relation base/16385/58318948
Can I somehow get pg_dump to "ignore" that block and dump everything else?
The traditional solution is to zero out the bad block, eg using dd from
/dev/zero. It's easy to zero more than you intended, so practicing on a
scratch copy of the table is recommended.
But first you should check what kind of relation that is. If it's an
index, you could just REINDEX it instead.
So it is "just" blocknumber * blocksize .. offset, blocksize of zeroes.. ?
Or is the math harder?
--
Jesper
--
Sent via pgsql-admin mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Tom Lane
2011-10-09 20:21:56 UTC
Permalink
Post by Jesper Krogh
Post by Tom Lane
The traditional solution is to zero out the bad block, eg using dd from
/dev/zero. It's easy to zero more than you intended, so practicing on a
scratch copy of the table is recommended.
So it is "just" blocknumber * blocksize .. offset, blocksize of zeroes.. ?
Or is the math harder?
You have to account for the division of the table into segment files;
if blocknumber * blocksize is greater than 1GB, reduce modulo 1GB and
look to the appropriate "xxx.n" segment file. Otherwise it's what
you'd expect.

regards, tom lane
--
Sent via pgsql-admin mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Lukasz Brodziak
2011-10-09 20:33:04 UTC
Permalink
You may use this:
SET zero_damaged_pages = on;
VACUUM FULL corrupted_table;

Unfortunately zeroing pages will result in losing data written in them(will
be rewritten with zeros).
Post by Jesper Krogh
Post by Tom Lane
Post by Jesper Krogh
I have got a corrupt db.. most likely due to an xfs bug..
pg_dump: SQL command failed
pg_dump: Error message from server: ERROR: invalid page header in block
14174944 of relation base/16385/58318948
Can I somehow get pg_dump to "ignore" that block and dump everything else?
The traditional solution is to zero out the bad block, eg using dd from
/dev/zero. It's easy to zero more than you intended, so practicing on a
scratch copy of the table is recommended.
But first you should check what kind of relation that is. If it's an
index, you could just REINDEX it instead.
So it is "just" blocknumber * blocksize .. offset, blocksize of zeroes.. ?
Or is the math harder?
--
Jesper
--
http://www.postgresql.org/**mailpref/pgsql-admin<http://www.postgresql.org/mailpref/pgsql-admin>
Loading...