Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1usaDT-007Xyz-JJ for pgsql-bugs@arkaria.postgresql.org; Sun, 31 Aug 2025 05:03:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1usaDT-000aic-0P for pgsql-bugs@arkaria.postgresql.org; Sun, 31 Aug 2025 05:02:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1usaDS-000aiU-OS for pgsql-bugs@lists.postgresql.org; Sun, 31 Aug 2025 05:02:59 +0000 Received: from fout-b5-smtp.messagingengine.com ([202.12.124.148]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1usaDQ-002dBS-3A for pgsql-bugs@lists.postgresql.org; Sun, 31 Aug 2025 05:02:58 +0000 Received: from phl-compute-12.internal (phl-compute-12.internal [10.202.2.52]) by mailfout.stl.internal (Postfix) with ESMTP id 73FF41D0005E; Sun, 31 Aug 2025 01:02:56 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Sun, 31 Aug 2025 01:02:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1756616576; x=1756702976; bh=EeJTJw2H8o IhU/Jz0CDQdRObuSdQdUjzEOFGCbw8NQM=; b=gIZDaG+MK9TkgYE8EwvdaExDo5 GjREL3b/kqMFladoVzZeK4KO0Fu9Z4pQi1oVq/f4NyZvZ3Gu4EFxHGIcQt6tEIio ErV4SuyWCLynCFdzlY/c4Md1u+h6Bdlz88tkfLaZTEcIFQcE0vQGJj4Q1qKlpB+B 84xiG699HM85V5jZvmSiMsLaEbQVJPhzbgytuKdgkB3JIdtaJBX6n2Tu18hNA8ct H0Bx7XorbZqGD6vDVkOscOWcxVu7XttN0oSjlUpawQYvS0YH3nNJSXIRK2ztqEid +cca1Hygr9BdysnUnyPGdZTKu9VpbSLX0bP9XSy+kMPyB5JPE2ZLCY/TLIYA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1756616576; x=1756702976; bh=EeJTJw2H8oIhU/Jz0CDQdRObuSdQdUjzEOF GCbw8NQM=; b=hRzNFGj0ro+VzKhxQSCdtq6snxxg48ujj1gQJ9nvheGqoPmOtbt qxNZemTWg5x/i7+YrKFQscrakkkH3k3i+sB0sZtt5NO7ycJcQ/vEvcUdxh3YX0Oj h6NA9R5xlDtXZYdI9ISnvuMPhFF6+e4SbJVa/m59nnBT94OT7z5vMXvqS4DFDao8 bqiOS7xtbvjrI3WkFnuRH5fioaJrGo1Mpx+KE/c5R/EkhV1FhpJfWWh6YiRgpO1O zPxgyI9hYm/kEuSNajPymCfFNwvpACPaG7lCI9f7ZhgKVC7BJSi1XzIlPP7Ok+Ly WYCAfYh3XWHDOgMJen8yc6bFx3bHeKrJdIg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddukeekfeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtdorredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepffduleehgefhkeefgfeftdfhkedu tddvhfdukeeggeehieekffelhfelkeehteefnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidp nhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohephhhtrg hmfhhiughssehgmhgrihhlrdgtohhmpdhrtghpthhtohepshhrihhnrghthhdvudeffees ghhmrghilhdrtghomhdprhgtphhtthhopeguuhhomhhirdhpvghnghesqhhqrdgtohhmpd hrtghpthhtohepphhgshhqlhdqsghughhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdr ohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 31 Aug 2025 01:02:54 -0400 (EDT) Date: Sun, 31 Aug 2025 14:02:47 +0900 From: Michael Paquier To: Greg Sabino Mullane Cc: Srinath Reddy Sadipiralla , "duomi.peng" , pgsql-bugs Subject: Re: bug reapper: Empty query_id in pg_stat_activity Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="0fHMkrX38XKzbVfE" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0fHMkrX38XKzbVfE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Aug 28, 2025 at 08:42:32AM -0400, Greg Sabino Mullane wrote: > This just moves the race condition around a little - you can end up with a > query that does not agree with its query_id. The query ID assignment in a backend entry has always been kind of a pessimistic concept: the backend sets it when it knows about it. Note that there are a few cases with the extended query protocol for execute messages, where the query ID can be set only when we're in the executor start path. Always reporting the previous query ID if the current one is not set is also breaking an existing property of the current implementation: a NULL query ID means that we are in the process of running a query. The proposed patch would always show a query ID, even if the backend has begun running an entire different query, for which the query ID would be assigned later, just we don't know about it yet. In short, I don't think that there's anything to fix here. The proposed patch is breaking some assumptions that the current backend implementation relies on. -- Michael --0fHMkrX38XKzbVfE Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmiz13cACgkQnvQgOdby QH0Mxw//WSbkXNgmyoHnHwwPXE6kCnbU2lrPf6BTa8+Hf6hloEe+vhdyDFiTZXx5 3Qq3sAPo0Tdwbt0CQ3uRUDJjPQnk+0JkJTp96RaVsr+UWVErdE7Rq3acGDuJeItI UyJFqDb340+iDekqk9eR19IZrXfxI2cHmzUxPPLxUTY+Ai1iI5BpQtaYGlyRbXc3 +c440jHnBPv/9uW1ft0wt3tPr/If5VLQYd/ShsJy/zVMCrMKP15A/fkcjeHdnK+P HcvSh7AsPkhA47g6KNIJdFhlMPooDxuIu0KBqQWUlLL1pqKCiNevYEuDzQNqgvTx DheV8/qEs4BsbssgtEECfTxTQHNV+db/J8mJlQJKNIuA9BwKwXp6cpFFNZNSa3ju /IqKMUqJg0bZA8Tyfph8Tx0XEV8A8oDI8vktJkIToZG2ClHypQ5TiWLouRDOaVKN w3+9MDkB4vJ6e34+yq+4nMjtnZDFLcMkCOG6GMnmDPSPxQqZw6VQpiRtsFlx9qXB Ca950FZCdnPjtl4nqtSzqKKi/OtGshicx0K6ghbPOusamo0CehMYev7rlGs1wHjj lGlEtdvrfi+cDafbD07mubZ4WwwAAF/4X63XRmZOxcTUKCfbaRbzaOBoJVkCPuQy bD48gLfbl/A0zL5XfG3ay2O/rlIB8EQD5B1NDOuEqexsfdrit2I= =cTTh -----END PGP SIGNATURE----- --0fHMkrX38XKzbVfE--