GenericXLogUnregister seems like a pretty horrid idea - Mailing list pgsql-hackers

From Tom Lane
Subject GenericXLogUnregister seems like a pretty horrid idea
Date
Msg-id 17980.1460225744@sss.pgh.pa.us
Whole thread Raw
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: multivariate statistics v14
Next
From: Alexander Korotkov
Date:
Subject: Re: Move PinBuffer and UnpinBuffer to atomics