Re: [HACKERS] [PATCH] A hook for session start

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Cc: fabriziomello@gmail.com, Michael Paquier <michael.paquier@gmail.com>, Aleksandr Parfenov <a.parfenov@postgrespro.ru>, Pgsql Hackers <pgsql-hackers@postgresql.org>, Yugo Nagata <nagata@sraoss.co.jp>, Ashutosh Sharma <ashu.coek88@gmail.com>
Date: 2017-11-19T21:49:49Z
Lists: pgsql-hackers
Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
> I think this:

>     #define IsClientBackend() \
>         (MyBackendId != InvalidBackendId &&    \
>          !IsAutoVacuumLauncherProcess() &&    \
>          !IsAutoVacuumWorkerProcess() && \
>          !am_walsender && \
>          !IsBackgroundWorker)

> probably belongs somewhere more central. Surely this isn't the only
> place that we want to be able to run such a test?

Hm.  It also seems awfully awkward.  Perhaps it's not being used anyplace
performance-critical, but regardless of speed it seems like a modularity
violation, in that client backends have to be explicitly aware of
everything that isn't a "client backend".

Maybe it's time to invent something corresponding to AuxProcType
for non "aux" processes, or else to fold all types of Postgres
processes into the same enum.

			regards, tom lane


Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add hooks for session start and session end, take two