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 1vlnpl-0047By-2i for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Jan 2026 12:42:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vlnpj-004lad-2F for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Jan 2026 12:42:44 +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.96) (envelope-from ) id 1vlnpi-004laU-2x for pgsql-hackers@lists.postgresql.org; Fri, 30 Jan 2026 12:42:44 +0000 Received: from fhigh-a5-smtp.messagingengine.com ([103.168.172.156]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vlnph-000A9W-0V for pgsql-hackers@lists.postgresql.org; Fri, 30 Jan 2026 12:42:42 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.phl.internal (Postfix) with ESMTP id 209CA1400060; Fri, 30 Jan 2026 07:42:40 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Fri, 30 Jan 2026 07:42:40 -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=1769776960; x= 1769863360; bh=IXZxQx8zZaEJIr7iBGNYbIMQ3nmL5C8D3lMtif7zjms=; b=t ocm3AgT19hvkepoK69sl8v3yoYSK/VC8dzhgIl9Ww/UbCQxMDCy1w+8aljI0hWr2 0BVefABaaWDCH8+nYS+TglxeyMHXeAT+juDqmq81RdQ2Ce75PL1ljn+LrRbr/ke+ 1dQjMsDblxpn/rnzEXefilTLzUu0RaMbqJgt8Sk9ySQmzNkUPipf5E05WNhm9Dpe KgzfTh7iq1ckKjVw/kR6E/3WV40HpeCpqXEcPE+AUoJCbQ2900DLyl29m+QCKF6R Ge8LV7BsjZ+Om7RyhBgzsH9cxpj5ixCMPbwdlboAB3CIgvZfSdDoHBN5sE8OCcJF WQnjx2DkngF3BiRxRlRVA== 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=1769776960; x=1769863360; bh=I XZxQx8zZaEJIr7iBGNYbIMQ3nmL5C8D3lMtif7zjms=; b=u1wNcm9DY+qq+pW+Z +d1A/4yKnWiGOg+UrvSRAm0dn+CbKu5W/+kle4GHvjZZZU8ThP2dw93ga2aqUIh7 c0Pzt3zwXAN+oWZKsnnLMyU6L74x/YLaBv9NzSpFeKfxyauXbnR8Q3A2NT3PQwhw 4wnEemDsQ7HD/e25p5tzOUlKpGBBw8qI9jbiUhCOOgYOVqkVQn17A5JkL+gbPuvm hW3465GRreq7QSoMI5eMaW1NdvCS/2Kmxoo0SBD5kPl81RUVcsd3o1k2eoDw7Eif YzZW/p/cUKfLEbbyFY7rtaCExfFKabkPhXhDl3mqTkO7mm5QBn6uPh8bJTHZPdHP BhYcA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduieeltdejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheplmhlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsehkuhhrihhlvghmuhdruggvqeenucggtf frrghtthgvrhhnpeetuedvheffkeevgfeuheevteevkefggedttdeufeeuheduuddthfef fffhjeefffenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgv sehkuhhrihhlvghmuhdruggvpdhnsggprhgtphhtthhopeeipdhmohguvgepshhmthhpoh huthdprhgtphhtthhopegsvghrthhrrghnuggurhhouhhvohhtrdhpghesghhmrghilhdr tghomhdprhgtphhtthhopehmrghsrghordhfuhhjihhisehgmhgrihhlrdgtohhmpdhrtg hpthhtohepshgrmhhimhhsvghihhesghhmrghilhdrtghomhdprhgtphhtthhopehpghhs qhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrghdprhgtph htthhopehmihgthhgrvghlsehprghquhhivghrrdighiiipdhrtghpthhtohepiihsohhl thdrphgrrhhrrghgihesphgvrhgtohhnrgdrtghomh X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 30 Jan 2026 07:42:38 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1769776956; bh=FrWsdY3VoXsR2jdRS880bYMUZYEA73gSkdnIJ5JmA9U=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=BYiFW/EdgPoZKdylJMXyqezC2BJCXvupD/KkCCkvMPWkqd9sq0aqAtX6tL5lTD0hD KKBEszW9u0TGwIRShvXEjKShx58Mnuw8TGoomu1o6KRKjkjxMami/K/egGfqK0RLrz ku8xWw5ame5VO/WTJd+e8cNYfLxmtq9GSBBc6mmRk7qTcfrPtOJ2KyIbAHeSewd6pO AtAeVEcFlFCbhPkDLY0Z+kTP+V48lpnP3IZnMS6/oQi6jhslPyryEUe49ICWYG9eqy 5SqVU6rGCwJk1dMHYa2cLfD5nendTIYm7gSlyNB7vAoVAc9TV6kKbF2HDW4OwC4wKt ViX9nUphLxAgw== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id 3B5DE6A; Fri, 30 Jan 2026 13:42:36 +0100 (CET) Date: Fri, 30 Jan 2026 13:42:36 +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 Subject: Re: Flush some statistics within running transactions Message-ID: <202601301136.kvw5jklzhkru@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202601300940.gzzbe57cdvny@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: > Interesting. Bertrand asked me about this. He says[1] he diagnosed this > down to SetLatch being called immediately after the handler runs, and I > wonder if it's correct that other timeout handler functions used for > RegisterTimeout are doing SetLatch(). The SIGALRM handler > handle_sig_alarm() that calls the specific handler function already has > a SetLatch call, so why do we need another one here? 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: void CheckDeadLockAlert(void) { int save_errno = errno; got_deadlock_timeout = true; /* * Have to set the latch again, even if handle_sig_alarm already did. Back * then got_deadlock_timeout wasn't yet set... It's unlikely that this * ever would be a problem, but setting a set latch again is cheap. */ SetLatch(MyLatch); errno = save_errno; } I wonder if it would work to move the SetLatch() that's currently at the top of handle_sig_alarm() to the bottom, after we have called all the specific handlers, and remove the ones that are there. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/