Re: Transaction callback

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Transaction callback
Дата
Msg-id 6280.1075577196@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Transaction callback  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: Transaction callback  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Why can't we call the callback before we commit so it can modify the
> database?

He wanted that too...

A user callback before we start the commit sequence seems doable,
although there's some question in my mind of exactly when it should
happen.  The last point at which it'd really be safe to execute
arbitrary actions is just before DeferredTriggerEndXact() --- what
if you make a database change that fires deferred triggers?  Surely
those would have to be executed before we can commit.  As you move
further down in the sequence, successively larger chunks of
functionality become unsafe to invoke.  But depending on what you
want the callback for, you might not want all that stuff running
after you get called; all of it can potentially cause errors and thereby
prevent the commit from occurring.

I got the impression that Thomas wanted this in order to kluge up
some kind of two-phase-commit support, in which case he really needs
to get control at the point where we're just about to really truly
commit (ie, write the commit WAL record).  That's certainly not a
location where we want random users to be inserting code; as such
I don't think that exposing a callback hook is the right answer.
My advice to him is to go in and change the code.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Helgason
Дата:
Сообщение: Re: Transaction callback
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Transaction callback