Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k0E8z-0005tR-2f for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Jul 2020 01:11:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k0E8x-00022S-Oa for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Jul 2020 01:10:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k0E8v-00022L-UC for pgsql-hackers@lists.postgresql.org; Tue, 28 Jul 2020 01:10:59 +0000 Received: from [66.111.4.25] (helo=out1-smtp.messagingengine.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k0E8o-0001Nm-Os for pgsql-hackers@postgresql.org; Tue, 28 Jul 2020 01:10:56 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 940125C01AC; Mon, 27 Jul 2020 21:10:39 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 27 Jul 2020 21:10:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=n0ghX5wsa+blQpPCpiEvbrcTMrA hGtosA2YwdVxvMGY=; b=byRPTKgYQF/ymTGejK4T4sO4nSr004lVd2Cdg1SY7El Bho0uSFpCBh5vMTNfOtuQERFCPMg5WbHIdR6Oq5G0QBZSG9eba9J46pvUIs2lfNY CvGk6GwmrsuZMrhQjb/cA0gRiJp/upgFw6uHdUEDkDDMM9At3j9kv1lSQN3+ak/y 2Kkhh0UAy+QNnbmQq8jR9GQhMzTUkUdEA87m3bpDMbG8CSnGvsTDMpXLO96Exm9R U6i71+f7gL6yw3SDS/XPecIsw+TyhP/ZRQo7lOEg2pZcS6EpoUvGQDEWn50t7Eu9 2oCwAKIM75oD+1b7T7aRKRgplB6Xp/GWufCPGHF44oQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=n0ghX5 wsa+blQpPCpiEvbrcTMrAhGtosA2YwdVxvMGY=; b=qO8S1Qf0+FnXEv7PGMFjJ6 r5DKXvk2OPSRHhud67xTdnsBA4JZvW0a32qTMg7FUr0pAJenBjKG5C3UZbSV/Lgf dGsciIFy4HbBTTQmmOWz/TviJ2gyHrD+zOPUBAgLsqyRZ7OQ92V04Sv0yms4sPXR WJMgaxDdQolu8VJR76l3IN6Ga8r2MnlbXRasif7KGTb50wXNXY/cIWtmcb/5jv6h V/yrb6bYhQDuFzVewxpt1Krg84ZO1/bhXnzhUHfPLc9fB5BlC9NRRxXIZ/KaUNCP uh4H3bM7Lg56OBhhhU4oRtPwHErF6OjhYmV87AxgdEG1XvJ4Admr4fV/iMB/zlsw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedriedugdegfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdejtddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepvdegudeuhfdtueeltedtveejheeh ieevueeigeelteegleejleeiueeiheegvefhnecukfhppeduuddurddutddvrddukedtrd dukeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep mhhitghhrggvlhesphgrqhhuihgvrhdrgiihii X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id DCF143280064; Mon, 27 Jul 2020 21:10:36 -0400 (EDT) Date: Tue, 28 Jul 2020 10:10:33 +0900 From: Michael Paquier To: Justin Pryzby Cc: Alvaro Herrera , Julien Rouhaud , Tomas Vondra , pgsql-hackers@postgresql.org Subject: Re: expose parallel leader in CSV and log_line_prefix Message-ID: <20200728011033.GA28700@paquier.xyz> References: <20200721043325.GC17300@paquier.xyz> <20200722153605.GA961@alvherre.pgsql> <20200723005214.GD26630@paquier.xyz> <20200726074206.GB4351@paquier.xyz> <20200726185427.GI4286@telsasoft.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="vtzGhvizbBRQ85DL" Content-Disposition: inline In-Reply-To: <20200726185427.GI4286@telsasoft.com> X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.111.4.25 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --vtzGhvizbBRQ85DL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Jul 26, 2020 at 01:54:27PM -0500, Justin Pryzby wrote: > + > + %P > + For a parallel worker, this is the Process ID of its leader > + process. > + > + no > + Let's be a maximum simple and consistent with surrounding descriptions here and what we have for pg_stat_activity, say: "Process ID of the parallel group leader, if this process is a parallel query worker." > + case 'P': > + if (MyProc) > + { > + PGPROC *leader = MyProc->lockGroupLeader; > + if (leader == NULL || leader->pid == MyProcPid) > + /* padding only */ > + appendStringInfoSpaces(buf, > + padding > 0 ? padding : -padding); > + else if (padding != 0) > + appendStringInfo(buf, "%*d", padding, leader->pid); > + else > + appendStringInfo(buf, "%d", leader->pid); It seems to me we should document here that the check on MyProcPid ensures that this only prints the leader PID only for parallel workers and discards the leader. > + appendStringInfoChar(&buf, ','); > + > + /* leader PID */ > + if (MyProc) > + { > + PGPROC *leader = MyProc->lockGroupLeader; > + if (leader && leader->pid != MyProcPid) > + appendStringInfo(&buf, "%d", leader->pid); > + } > + Same here. Except for those nits, I have tested the patch and things behave as we want (including padding and docs), so this looks good to me. -- Michael --vtzGhvizbBRQ85DL Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl8fewkACgkQnvQgOdby QH3yCA/9EXezSrTB+m3g8I9zh8RkAqYmijQe84T9iA9BdhFltHlSp8RSSZf0xz2K DRfSFfO5wmIPlrTfc++A2z7noHueruRRJa+yjwNyF0pCQr4iB1qwP1Pks/qeTrn9 l+AkAROmiNnMf2Jyvucf8qsZrbP/I96Wqvbo3kc4Qp8NMYNtK3Q/VQYxUPfVb4bo 47EiJYMe24GntehKwDRB6SeZldIgaazatKBoPC7HzaSg8M4XNZ23VTbrV73hyTA8 JhRJKQslo0HyzJvqn0jObO1ly2ZxFvLg/1A0hW9cAoLnkTN27ko9MMACxZ3mkcpC n0HA1AzbSi7lI/QT5dOkqQS0au7x2nbPytOKPHK0K0Y9u5Aatz5g7sDwu8JCyw2M DFP/xkQOobHiEC3q8qsh2woOQUj6PLLXQ+JrgFxz1VnegiSIV6qUEiUIDJjDwMNP PhxUq574zbgF6kCrlp5/g30l8Wb/EUI9mhf0wHR60Ogv6AsYFyY1XzYuQdjzK9j5 7dJwpIvPqaD+POjcAIk+nXJwsULX/nA783mJ1y8loVtlit4HB9UWERh3n72jkJ9r f3fCmb3/MKbNWEKgos1EDUVcN/IuuOn2DFuIeIUaQDmrBzdeU35QaNw/ZiEnPttm JHuPNIA2uT5LskwKcHI90va2VMv4dKXxp0sPTEjADa8mL4NzPFI= =xzox -----END PGP SIGNATURE----- --vtzGhvizbBRQ85DL--