Re: [PATCH 3/5] Split out xlog reading into its own module called xlogreader

Alvaro Herrera <alvherre@2ndquadrant.com>

From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Andres Freund <andres@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org
Date: 2013-01-16T19:20:52Z
Lists: 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


Commits

  1. Prevent creation of postmaster's TCP socket during pg_upgrade testing.