GenericXLogUnregister seems like a pretty horrid idea

Started by Tom Laneabout 10 years ago1 messageshackers
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

I've been doing some code review in generic_xlog.c, and I find that
GenericXLogUnregister is implemented in what seems to me to be a
completely unsafe way: it shoves over the per-page array entries for
following pages. The problem with that is that it invalidates the Page
pointers previously returned for those pages by GenericXLogRegister;
an effect that is neither documented, nor reasonable for callers to
cope with.

I cannot see any very good reason why callers should need an unregister
function anyway: if they're doing something so complicated that they might
change their minds partway through an XLOG record through about whether a
page needs to be modified, that code is badly in need of redesign. (And
yes, I am asserting that against blinsert() in particular. That's not
nice code.)

I think we should get rid of this function. If people need to do
something like that, they should do GenericXLogAbort() and start over.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers