From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de> |
Cc: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>, legrand legrand <legrand_legrand(at)hotmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Hooks for session start and end, take two |
Date: | 2019-10-03 02:03:39 |
Message-ID: | 20191003020339.GC1586@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Oct 02, 2019 at 10:23:54AM -0700, Andres Freund wrote:
> - the startup hook isn't actually guaranteed to be able to write
> anything, we might be in hot-standby
Right.
> - the startup hook doesn't just run in normal sessions, it also runs in
> walsenders, including ones not connected to a database. But for some
> implementation reasons it won't run for background workers.
The idea here is to have a hook which can be triggered at the start of
a process which can be externally triggered, which I guess is normal
even for WAL senders not connected to a database.
> - do we actually want to run code like this for e.g. FATAL errors?
That was the intention.
> - THERE IS NOT A SINGLE COMMENT EXPLAINING WHAT CAN BE SAFELY DONE IN THESE
> HOOKS. In fact, outside of the tests, the only comments in this are:
> /* Hook for plugins to get control at start and end of session */
> /* Hook for plugins to get control at start of session */
> /* Hook at session end */
> /* Hook for plugins to get control at end of session */
We include in the backend code a dozen of hooks or so similar to this
one (excluding from the count GUC and reloption hooks and such). For
most of them we do not provide much extensive documentation nor
explanations similar to that, so it is rather unclear what would be a
minimum and acceptable set of comments and/or documentation which
would be fine (the same comment could basically apply to the planner
or post-parse hooks). Should we finally add a specific section in the
user-visible docs even if there has been reluctance to do so? My
guess is that we go down to this kind of requirement if we want to be
able to never forget to add documentation for any kind of new hook.
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2019-10-03 02:08:43 | Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays |
Previous Message | Michael Paquier | 2019-10-03 01:51:32 | Re: Hooks for session start and end, take two |