Re: exposing wait events for non-backends (was: Tracking wait event for latches)
Amit Langote <langote_amit_f8@lab.ntt.co.jp>
From: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
To: Kuntal Ghosh <kuntalghosh.2007@gmail.com>,
Michael Paquier <michael.paquier@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Craig Ringer <craig@2ndquadrant.com>,
Kevin Grittner <kgrittn@gmail.com>,
Andres Freund <andres@anarazel.de>,
Alvaro Herrera <alvherre@2ndquadrant.com>,
Thomas Munro <thomas.munro@enterprisedb.com>,
Alexander Korotkov <a.korotkov@postgrespro.ru>,
PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Date: 2017-03-07T10:54:48Z
Lists: pgsql-hackers
Hi Kuntal,
Patches apply and compile fine. Works as advertised.
Some minor comments on the patches themselves.
In 0001:
- * pgstat_bestart() -
+ * pgstat_procstart() -
+ *
+ * Initialize this process's entry in the PgBackendStatus array.
+ * Called from InitPostgres and AuxiliaryProcessMain.
Not being called from AuxiliaryProcessMain(). Maybe leftover comment from
a previous version. Actually I see that in patch 0002, Main() functions
of various auxiliary processes call pgstat_procstart, not
AuxiliaryProcessMain.
+ * user-defined functions which expects ids of backends starting from
1 to
s/expects/expect/g
+/*
+ * AuxiliaryPidGetProc -- get PGPROC for an auxiliary process
+ * given its PID
+ *
+ * Returns NULL if not found.
+ */
+PGPROC *
+AuxiliaryPidGetProc(int pid)
+{
+ PGPROC *result;
Initialize to NULL so that the comment above is true. :)
In 0002:
@@ -248,6 +248,9 @@ BackgroundWriterMain(void)
*/
prev_hibernate = false;
+ /* report walwriter process in the PgBackendStatus array */
+ pgstat_procstart();
+
s/walwriter/writer/g
Patch 0004 should update monitoring.sgml.
Thanks,
Amit
Commits
-
Show more processes in pg_stat_activity.
- fc70a4b0df38 10.0 landed