Hi, a recent discussion about possible data corruption (in the general list) suggests that a tool for offline integrity check might be useful. Something that might be run when the database is shut down, to check that the data files are OK.
The idea is to read all heap blocks and check for various 'suspicious' things like 'pd_lower > pd_upper', invalid lengths (negative lengths, resulting in in alloc errors) etc. It might list blocks that are somehow corrupted, dump them in a separate file etc. Right now I do have a very simple tool that reads a given file and performs a lot of checks at the block level (as described in bufpage.h), and the next step should be validating basic structure of the tuples (lengths). And that's the point where I'm stuck right now - I'm thinking what might be the most elegant way to get info about attributes, without access to the pg_attribute catalog (the tool is intended for offline checks). I've figured out the catalog-to-file mapping (in relmapper.c), but now I'm wondering - it's just another relation, so I'd have to read the block, parse the items and interpret them (not sure how to do that without the pg_attribute data itself). So I wonder - what would be an elegant solution? regards Tomas -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers