Re: Hooks for session start and end, take two
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Andres Freund <andres@anarazel.de>
Cc: Fujii Masao <masao.fujii@gmail.com>, Fabrízio de Royes Mello <fabriziomello@gmail.com>, legrand legrand <legrand_legrand@hotmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Alvaro Herrera <alvherre@2ndquadrant.com>, Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2019-10-03T04:20:09Z
Lists: pgsql-hackers
Attachments
- session-hook-v2.patch (text/x-diff) patch v2
On Wed, Oct 02, 2019 at 09:09:53PM -0700, Andres Freund wrote: > On 2019-10-03 11:03:39 +0900, Michael Paquier wrote: >> 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. > > But what can you do in that situation? Without a database connection, > for example, you better not consider inserting anything into a table. Adding extra custom logging information, or plug that information elsewhere than Postgres. I have use cases for that when it comes to store external telemetry data or audit things for events happening specifically in Postgres. > I have *SERIOUS* problems with performing additional writing > transactions in case of a FATAL. Something might have thrown that for a > reason, and just carrying on executing an arbitrary amount of code, this > might even involve triggers etc, imo seriously is not OK. Well, hook authors can do a lot of stupid things.. Anyway it looks that the end hook is out of scope as far as the discussion has gone based on the lack of facility, and that there is still interest for the start hook. I am just attaching a separate patch which adds only the start hook. The discussion could always respawn from that. This takes care of the HBA configuration when testing on Windows, and the module is still named "hooks" intentionally to avoid a future rename. -- Michael
Commits
-
Add hooks for session start and session end, take two
- e788bd924c19 13.0 landed