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

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

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>, Fabrízio Mello <fabriziomello@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-20T03:11:08Z
Lists: pgsql-hackers
Michael Paquier <michael.paquier@gmail.com> writes:
> I was the one suggesting to Fabrizio to look at how backend types are
> evaluated in pgstat.c after an off-list discussion. Agreed that this
> result is fragile as this makes two places dependent on the process
> types. Why not simply moving all the business of pgstat_bestart()
> evaluating which st_backendType to use into a common routine and have
> pgstat.c and have this utility use this API? pgstat.h already includes
> BackendType as an enum to use so this could live with a routine
> available in pgstat.c. Or would it be cleaner to have a new thing
> dedicated to process-related information, say as
> src/backend/utils/misc/process_info.c? It is indeed strange to have a
> session-related feature depend on something with statistics.

This is really about consolidating a whole bunch of ad-hoc stuff.
I don't think pgstat has any particular pride of place here.  It
should be one consumer of a common API.

The stuff related to AuxProcType is in miscadmin.h, so one possibility
is to put the new enum there.  But I could see inventing a whole new
header for this, "utils/proctype.h" or so.

			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