Re: [PATCH 3/5] Split out xlog reading into its own module called xlogreader - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: [PATCH 3/5] Split out xlog reading into its own module called xlogreader
Date
Msg-id 20130116192052.GF4667@alvh.no-ip.org
Whole thread Raw
In response to [PATCH 3/5] Split out xlog reading into its own module called xlogreader  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
Andres Freund wrote:

> The way xlog reading was done up to now made it impossible to use that
> nontrivial code outside of xlog.c although it is useful for different purposes
> like debugging wal (xlogdump) and decoding wal back into logical changes.

I have pushed this part after some more editorialization.

Most notably, (I think,) I removed the #ifdef FRONTEND piece.  I think
this should be part of the pg_xlogdump patch.  Sorry about this.

Also I changed XLogReaderAllocate() to not receive an initial read
starting point, because that seemed rather pointless.  Both xlog.c and
the submitted pg_xlogdump use a non-invalid RecPtr in their first call
AFAICS.

There was a bug in xlog.c's usage of XLogReadRecord: it was calling
ereport() on the errorbuf when the return value was NULL, which is not
always sane because some errors do not set the errorbuf.  I fixed that,
and I documented it more clearly in xlogreader.h (I hope).

I made some other minor stylistic changes, reworded a few comments, etc.

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Materialized views WIP patch
Next
From: Tom Lane
Date:
Subject: Re: CF3+4