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

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH 3/5] Split out xlog reading into its own module called xlogreader
Date: 2013-01-16 19:20:52
Message-ID: 20130116192052.GF4667@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-01-16 19:28:05 Re: CF3+4
Previous Message Josh Berkus 2013-01-16 19:12:07 Re: Materialized views WIP patch