Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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: xlogutils-refactor-2.patch
Description: text/x-diff (76.7 KB)

Responses

pgsql-patches by date

Next:From: Tom LaneDate: 2008-06-10 15:02:45
Subject: Re: \timing on/off
Previous:From: Alvaro HerreraDate: 2008-06-10 14:22:47
Subject: Re: Tentative patch for making DROP put dependency infoin DETAIL

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group