snaga/xlogdump — pull request #28 by ioguix (2012-08-13 11:57:57+00:00)
Title: Adding --check option to check WAL coherence

Some days ago, a client of mine asked me if some tools were existing to check produced WAL sanity (in particular, let's say they have some trouble with their FS).

AFAIK, no tool is taking care of this (despite PostgreSQL itself when restoring, but it's not an option and a bit overkill anyway). I thought "xlogdump" would be the best tool to add this feature and start working on HEAD.

The patch is moving all existing error messages to stderr. When "--check" is givent, it stop reading the WAL as soon as an error is found.

As it's the first time I'm working on WAL related code, I'm not 100% clear about all the parts of this patch, neither when raising an error or not, especially about the continuous pages.

Here is my commit comment:
Force "xlogdump" to stop and returns 1 on the first incoherent found the
WAL file. Using "--check", "xlogdump" will not dump anything from the
file, it just performs a sanity check. Conflict with all other options.

This options aims to check for corruption on wal file archived (or not).

Thank you for your next review and comment !