On 08/13/2014 04:15 PM, Heikki Linnakangas wrote:
> Hmm, thinking about this some more, there is one sensible way to split
> this patch: We can add the XLogReplayBuffer() function and rewrite all
> the redo routines to use it, without changing any WAL record formats or
> anything in the way the WAL records are constructed. In the patch,
> XLogReplayBuffer() takes one input arument, the block reference ID, and
> it fetches the RelFileNode and BlockNumber of the block based on that.
> Without the WAL format changes, the information isn't there in the
> record, but we can require the callers to pass the RelFileNode and
> BlockNumber. The final patch will remove those arguments from every
> caller, but that's a very mechanical change.
>
> As in the attached patch. I only modified the heapam redo routines to
> use the new XLogReplayBuffer() idiom; the idea is to do that for every
> redo routine.
>
> After applying such a patch, the main WAL format changing patch becomes
> much smaller, and makes it easier to see from the redo routines where
> significant changes to the WAL record formats have been made. This also
> allows us to split the bikeshedding; we can discuss the name of
> XLogReplayBuffer() first :-).
Here's a full version of this refactoring patch, all the rmgr's have now
been updated to use XLogReplayBuffer(). I think this is a worthwhile
change on its own, even if we drop the ball on the rest of the WAL
format patch, because it makes the redo-routines more readable. I
propose to commit this as soon as someone has reviewed it, and we agree
on a for what's currently called XLogReplayBuffer(). I have tested this
with my page-image comparison tool.
- Heikki