Refactoring xlogutils.c

From: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
To: "pgsql-patches" <pgsql-patches(at)postgresql(dot)org>
Subject: Refactoring xlogutils.c
Date: 2008-06-10 14:49:45
Message-ID: 484E9489.3020107@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Attached is an updated version of my patch to refactor the
XLogOpenRelation/XLogReadBuffer interface, in preparation for the
relation forks patch, and subsequently the FSM rewrite patch.

I'm satisfied enough with it that I plan to commit it in a few days,
barring objections.

Summary of changes:

- XLogOpenRelation is gone. XLogReadBuffer now takes a RelFileNode as
argument, instead of Relation. Fix all callers.
- For the routines that need a fake, or lightweight, Relation struct
anyway, there's a new function called
XLogFakeRelcacheEntry(RelFileNode), that returns a palloc'd Relation struct.
- Add ReadBufferWithoutRelcache variant of ReadBuffer, that takes
RelFileNode instead of Relation as argument. This is what XLogReadBuffer
uses internally.

The only user-visible changes are these error message changes:

1. "invalid page header in block %u of relation %s" and "unexpected data
beyond EOF in block %u of relation \"%s\" messages, emitted from
ReadBuffer, no longer print the relation name, but only its relfilenode.
(This is because relation name is no longer conveniently available where
that message is emitted. It could be passed there if necessary, but it
doesn't seem worth the extra complexity)

2. elog("failed to additem to index page in \"%s\""), in gistutil.c. For
similar reasons, no longer prints the relation name. Unfortunately,
gistfillbuffer() doesn't know the relfilenode either. Again we could
pass it, but it doesn't seem worth the extra complexity, given that this
is just a "should never happen" elog, and the user should usually know
which index is at fault from the context information.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

Attachment Content-Type Size
xlogutils-refactor-2.patch text/x-diff 76.7 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2008-06-10 15:02:45 Re: \timing on/off
Previous Message Alvaro Herrera 2008-06-10 14:22:47 Re: Tentative patch for making DROP put dependency info in DETAIL