Re: Expose lock group leader pid in pg_stat_activity

Julien Rouhaud <rjuju123@gmail.com>

From: Julien Rouhaud <rjuju123@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>, Sergei Kornilov <sk@zsrv.org>, Guillaume Lelarge <guillaume@lelarge.info>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-02-06T08:23:33Z
Lists: pgsql-hackers

Attachments

On Thu, Feb 06, 2020 at 09:24:16AM +0900, Michael Paquier wrote:
> On Wed, Feb 05, 2020 at 07:57:20AM +0100, Julien Rouhaud wrote:
> > This looks good, thanks a lot!
> 
> Thanks for double-checking.  And done.

Thanks!

While on the topic, is there any reason why the backend stays a group leader
for the rest of its lifetime, and should we change that?

Also, while reading ProcKill, I noticed a typo in a comment:

    /*
     * Detach from any lock group of which we are a member.  If the leader
-    * exist before all other group members, it's PGPROC will remain allocated
+    * exist before all other group members, its PGPROC will remain allocated
     * until the last group process exits; that process must return the
     * leader's PGPROC to the appropriate list.
     */

Commits

  1. Fix typo in proc.c

  2. Add leader_pid to pg_stat_activity