Re: Hooks for session start and end, take two
От | Andres Freund |
---|---|
Тема | Re: Hooks for session start and end, take two |
Дата | |
Msg-id | 20191003150911.rgyr7ov7wyznrhyr@alap3.anarazel.de обсуждение исходный текст |
Ответ на | Re: Hooks for session start and end, take two (Fabrízio de Royes Mello <fabriziomello@gmail.com>) |
Ответы |
Re: Hooks for session start and end, take two
|
Список | pgsql-hackers |
Hi, On 2019-10-03 11:19:58 -0300, Fabrízio de Royes Mello wrote: > On Thu, Oct 3, 2019 at 1:35 AM Andres Freund <andres@anarazel.de> wrote: > > > > [...] > > > > In this state I think this patch should be flat out rejected. > > > > Ok. > > > I'm seriously baffled at how this stuff is being pursued aggressively, > > quite apparently without any serious design considerations. I mean this > > stuff had to be backed out twice, yet it's being reproposed without much > > consideration for concerns? > > > > And what if (again) for the first version of session start hook we do it > just for: > - client backends > - background workers > > For sure we'll need new design, but for now I'm can't imagine a use case > for sessions different than listed above. I think what would need to be designed is something more like RegisterXactCallback(): /* * start- and end-of-transaction callbacks for dynamically loaded modules */ typedef enum { XACT_EVENT_COMMIT, XACT_EVENT_PARALLEL_COMMIT, XACT_EVENT_ABORT, XACT_EVENT_PARALLEL_ABORT, XACT_EVENT_PREPARE, XACT_EVENT_PRE_COMMIT, XACT_EVENT_PARALLEL_PRE_COMMIT, XACT_EVENT_PRE_PREPARE } XactEvent; typedef void (*XactCallback) (XactEvent event, void *arg); extern void RegisterXactCallback(XactCallback callback, void *arg); extern void UnregisterXactCallback(XactCallback callback, void *arg); which would be called at various parts of a processes lifetime. Maybe something like: 1) shortly after process creation 2) shortly after shared memory attach 3) after database connection has been established 4) after database writes are possible (this excludes database-less walsenders) 5a) before closing database connection due to fatal error (with a note saying that no writes are ever allowed) 5b) before closing database connection due to normal exit (with a note saying that errors better be handled, and that no transaction may escape) 6) before shared memory detach 7) before final exit Greetings, Andres Freund
В списке pgsql-hackers по дате отправления: