offline consistency check and info on attributes

From: Tomas Vondra <tv(at)fuzzy(dot)cz>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: offline consistency check and info on attributes
Date: 2011-04-24 16:49:31
Message-ID: 4DB4549B.3060109@fuzzy.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yves Weißig 2011-04-24 17:09:52 operator classes for index?
Previous Message Tom Lane 2011-04-24 16:25:29 Re: windows consolidated cleanup