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.96) (envelope-from ) id 1vlpdP-004RNX-2e for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Jan 2026 14:38:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vlpdN-00550U-31 for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Jan 2026 14:38:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vlpdN-00550J-0I for pgsql-hackers@lists.postgresql.org; Fri, 30 Jan 2026 14:38:06 +0000 Received: from fout-a1-smtp.messagingengine.com ([103.168.172.144]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vlpdK-00000000DAR-1dxR for pgsql-hackers@lists.postgresql.org; Fri, 30 Jan 2026 14:38:05 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id 47849EC0476; Fri, 30 Jan 2026 09:38:00 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Fri, 30 Jan 2026 09:38:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm1; t=1769783880; x= 1769870280; bh=+ybgMQtoLc04DBnAVep4QoBeG05x5WzxATNd/Syu6eQ=; b=0 pylxhYZLZHjuiJr2K+Hqqyq3bajJyrBkXppNEAJz0CJncYmRpbHxOc3aUjH15J1r LzDoksqi7rOw0lJrQE43k66d0Su3F4akVdpftvXR8KVVSfMurVZ+2x1Sfk14sRWR 1mfQkiZuahL8r4mxbfq2HXzmWrl9HbB3/n+l6yjrI5cyKUU+9LKKyOjJJGgS+8a4 mlfCiMqs34GU/Wx6xcmR7N6noRaS40PPeTUfGQOwU8yYdtQeFLntQmZH0aOsinVW UivD7+EssbTHM3XoFqfxSpa/P1GtlwvVfBNZM8HYz8TlKqjOXHZE1P0k1ZyqOC4f 5x494WdZL4sO0bHHZwDKQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1769783880; x=1769870280; bh=+ ybgMQtoLc04DBnAVep4QoBeG05x5WzxATNd/Syu6eQ=; b=c0cD0CNX/VzjyvB6T nfow1mvMxVm4kIGteer98Vuyr2kLTIiDReWLApTHf3Q6AO1e9mwwZIT/Qyre1W6f 7WdVCbTm8wCDR8dRtD2XZcPUF8O7hOlBMU4wMABVgdzYUKsNw+plsEi7pITDv2wX 4fJ/lYGFcVSMqpJWVEe1DSNa/yVvFWMIVo9tJ2jeRBBSmtm3V9wb7LBHXXdHmiws R0KrAnl3CVOIJ8sy+vkOZtdX8oBhOLs1qcb/oFxdFoZyS7ayqfU4wdvGr1a7DGG4 efS5bVduVyYaUQzCVi6obkgDAae7/uwFJPQcK6NJutNzr46HbhRWs8YtalJ+mEz7 3m8lQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduieelfedtucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheplmhlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsehkuhhrihhlvghmuhdruggvqeenucggtf frrghtthgvrhhnpeevvefgtdfhvdefkefhkefgtdffuedtvdffiedufefhueevueegheeu veeffedukeenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgpdgtihhrrhhush dqtghirdgtohhmpdgvnhhtvghrphhrihhsvggusgdrtghomhenucevlhhushhtvghrufhi iigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgvrhhrvgeskhhurhhilh gvmhhurdguvgdpnhgspghrtghpthhtohepjedpmhhouggvpehsmhhtphhouhhtpdhrtghp thhtoheprghnughrvghssegrnhgrrhgriigvlhdruggvpdhrtghpthhtohepsggvrhhtrh grnhguughrohhuvhhothdrphhgsehgmhgrihhlrdgtohhmpdhrtghpthhtohepmhgrshgr ohdrfhhujhhiihesghhmrghilhdrtghomhdprhgtphhtthhopehsrghmihhmshgvihhhse hgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrsheslhhishht shdrphhoshhtghhrvghsqhhlrdhorhhgpdhrtghpthhtohepmhhitghhrggvlhesphgrqh huihgvrhdrgiihiidprhgtphhtthhopeiishholhhtrdhprghrrhgrghhisehpvghrtgho nhgrrdgtohhm X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 30 Jan 2026 09:37:59 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1769783877; bh=JgglegIvDuC8pOQ54v8f29ms11VjxkQYfnIYc9/WU6E=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=Nl9CAiUoCQm/vr5CSLx1/jBxAMvJi5oIkszQi4OjAok62vTaYrUDphS46FCOEE2mz i5+fReoJ8wv+gUdWNR9Ej41ei2U44yeRqXwnGLWF3dt2WxlVE98Oi2f5rvYku712EI ZoGMXN7xce2kuXXci2y7s3FoVYENwqHJfkpwv1zRnqH9z/y0seSJRvxvGhgU1auHls nzq8Z66qygzXM8+q9Q5tvfy+BRGKIw+gTqKM0uSrnd9wrgEj6Ulc6QXNyKSIom6bFk ubtFM7U1R12ze2DsETlLaHScwkpuXYXN/FPCRUERAobm/7hGoDg6OZjX066Z7Oma1P tLjP+12iDaYyA== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id 7E4616A; Fri, 30 Jan 2026 15:37:57 +0100 (CET) Date: Fri, 30 Jan 2026 15:37:57 +0100 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Fujii Masao Cc: Bertrand Drouvot , Sami Imseih , Michael Paquier , pgsql-hackers@lists.postgresql.org, Zsolt Parragi , Andres Freund Subject: Re: Flush some statistics within running transactions Message-ID: <202601301359.pwvtc26izo5z@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202601301136.kvw5jklzhkru@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2026-Jan-30, Álvaro Herrera wrote: > So apparently the first function to do this in postinit.c was added by > commit c6dda1f48e57 -- and apparently it was mimicking > CheckDeadLockAlert(), which at this time looked like this: I'm now wondering if CheckDeadLockAlert() really needed to have this in the first place, or it was just an exercise in paranoia ... it was added by commit 6753333f55e1, with the discussion in [1], and it's not clear to me that there was any theoretical or experimental evidence that it was necessary; the thread didn't discuss it, and the commit message doesn't either. Added Andres to CC as committer to this thread, maybe he remembers. [1] https://www.postgresql.org/message-id/flat/20150115020335.GZ5245%40awork2.anarazel.de Just for laughs I moved the SetLatch call in handle_sig_alarm() to the bottom, and remove the ones in handlers, on the theory that by the time the SetLatch call is reached, all the handlers have already run and thus the flag variables are set. Everything seems to continue to work: https://cirrus-ci.com/build/5758839359799296 (Though to be honest, it's not clear to me why it would matter at which point in handle_sig_alarm we call SetLatch relative to the variables being set, given that these variables are only going to matter once the signal handler returns to the original code and the next CHECK_FOR_INTERRUPTS is hit.) -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "Pensar que el espectro que vemos es ilusorio no lo despoja de espanto, sólo le suma el nuevo terror de la locura" (Perelandra, C.S. Lewis)