Обсуждение: GenericXLogUnregister seems like a pretty horrid idea

Поиск
Список
Период
Сортировка

GenericXLogUnregister seems like a pretty horrid idea

От
Tom Lane
Дата:
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