| From: | Andres Freund <andres(at)anarazel(dot)de> |
|---|---|
| To: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
| Cc: | Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Sami Imseih <samimseih(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> |
| Subject: | Re: Flush some statistics within running transactions |
| Date: | 2026-02-03 17:09:31 |
| Message-ID: | gx7blvhudcucxxojojuaraxh4wahr3spi4nvp4crjka77hvml6@vsqj4exyujy6 |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On 2026-02-03 06:19:13 +0000, Bertrand Drouvot wrote:
> On Fri, Jan 30, 2026 at 03:37:57PM +0100, Álvaro Herrera wrote:
> > (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.)
>
> Yeah, I think that we could keep the SetLatch() at the top of handle_sig_alarm().
Why at the top, rather than at the bottom? I don't think / I hope today's
signal handlers rely on it, but in the past we had cases where some signal
handlers ran code that could lead to a ResetLatch() being done.
Why does it matter for your patch whether SetLatch() is done multiple times as
part of various timeout handlers? I don't see how repeated SetLatch() calls
could trigger more interference with ProcSleep()? Once the latch is set it is
set (and indeed SetLatch() just returns immediately if it already is set).
> My understanding is that the signal handler runs to completion without being interrupted
> by the code it interrupted.
Right. But they can, on some platforms at least, be interrupted by *other*
signal handlers. I don't see any reason to believe that is not happening at
the moment.
> Out of curiosity, I also remove the ones in handlers (and keep the one in handle_sig_alarm()
> at the top), and everything seems to work fine:
>
> https://cirrus-ci.com/build/6277169619402752
That doesn't tell you very much, I think. Our coverage of the relevant edge
cases isn't that good, I think.
Greetings,
Andres Freund
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andres Freund | 2026-02-03 17:13:46 | Re: Change default of jit to off |
| Previous Message | Greg Sabino Mullane | 2026-02-03 17:08:08 | Re: Pasword expiration warning |