Re: expose parallel leader in CSV and log_line_prefix

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: expose parallel leader in CSV and log_line_prefix
Date: 2020-03-15 11:49:33
Message-ID: 20200315114933.udjdx5wcgwkjnw45@nol
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Mar 15, 2020 at 06:18:31AM -0500, Justin Pryzby wrote:
> See also:
> https://commitfest.postgresql.org/27/2390/
> https://www.postgresql.org/message-id/flat/CAOBaU_Yy5bt0vTPZ2_LUM6cUcGeqmYNoJ8-Rgto+c2+w3defYA(at)mail(dot)gmail(dot)com
> b025f32e0b Add leader_pid to pg_stat_activity

FTR this is a followup of https://www.postgresql.org/message-id/20200315095728.GA26184%40telsasoft.com

+1 for the feature. Regarding the patch:

+ case 'k':
+ if (MyBackendType != B_BG_WORKER)
+ ; /* Do nothing */

Isn't the test inverted? Also a bgworker could run parallel queries through
SPI I think, should we really ignore bgworkers?

+ else if (!MyProc->lockGroupLeader)
+ ; /* Do nothing */

There should be a test that MyProc isn't NULL.

+ else if (padding != 0)
+ appendStringInfo(buf, "%*d", padding, MyProc->lockGroupLeader->pid);
+ else
+ appendStringInfo(buf, "%d", MyProc->lockGroupLeader->pid);
+ break;

I think that if padding was asked we should append spaces rather than doing
nothing.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2020-03-15 12:28:00 Re: [HACKERS] Moving relation extension locks out of heavyweight lock manager
Previous Message Justin Pryzby 2020-03-15 11:18:31 expose parallel leader in CSV and log_line_prefix