Re: exposing wait events for non-backends (was: Tracking wait event for latches)

From: Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Craig Ringer <craig(at)2ndquadrant(dot)com>, Kevin Grittner <kgrittn(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: exposing wait events for non-backends (was: Tracking wait event for latches)
Date: 2017-03-09 18:52:32
Message-ID: CAGz5QC+wRhdkjasJQZd9DYTcJKUR487guvOvd41H6iDR4WFBDQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Amit,

On Tue, Mar 7, 2017 at 4:24 PM, Amit Langote
<Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> Hi Kuntal,
>
> Patches apply and compile fine. Works as advertised.
>
> Some minor comments on the patches themselves.
>
Thanks for the review.

> 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.
>
Fixed.

> + * user-defined functions which expects ids of backends starting from
> 1 to
>
> s/expects/expect/g
>
Fixed.

> +/*
> + * 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. :)
>
Fixed.

> In 0002:
>
> @@ -248,6 +248,9 @@ BackgroundWriterMain(void)
> */
> prev_hibernate = false;
>
> + /* report walwriter process in the PgBackendStatus array */
> + pgstat_procstart();
> +
>
> s/walwriter/writer/g
Fixed.

> Patch 0004 should update monitoring.sgml.
Added.

I've attached the updated patches. PFA.

--
Thanks & Regards,
Kuntal Ghosh
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
0001-Infra-to-expose-non-backend-processes-in-pg_stat_get.patch binary/octet-stream 31.3 KB
0002-Expose-stats-for-auxiliary-processes-in-pg_stat_get_.patch binary/octet-stream 7.2 KB
0003-Expose-stats-for-autovacuum-launcher-and-bgworker.patch binary/octet-stream 3.3 KB
0004-Add-proc_type-column-in-pg_stat_get_activity.patch binary/octet-stream 8.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-03-09 18:55:25 Re: [PATCH] Transaction traceability - txid_status(bigint)
Previous Message Robert Haas 2017-03-09 18:51:04 Re: Couple of issues with prepared FETCH commands