Re: Restart pg_usleep when interrupted

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: "Imseih (AWS), Sami" <samimseih(at)gmail(dot)com>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Restart pg_usleep when interrupted
Date: 2024-08-12 21:04:28
Message-ID: cb18c6a7-4394-4488-ad71-0b9826c8899c@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm trying to understand what the point of this patch is, so I went to
read this thread from the beginning:

> In the proposal by Bertrand [1] to implement vacuum cost delay tracking
> in pg_stat_progress_vacuum, it was discovered that the vacuum cost delay
> ends early on the leader process of a parallel vacuum due to parallel workers > reporting progress on index vacuuming, which was introduced in 17
> with commit [2]. With this patch, everytime a parallel worker
> completes a vacuum index, it will send a completion message to the leader.

Ok, so we might sometimes skip the sleep, if an interrupt is received. I
agree that's a bit sloppy, but probably won't make any difference in
practice.

> The facility that allows a parallel worker to report progress to the leader was
> introduced in commit [3].
>
> In the case of the patch being proposed by Bertrand, the number of interrupts > will be much more frequent as parallel workers would send a message
to the leader
> to update the vacuum delay counters every vacuum_delay_point call.

Hmm, I wonder if that's a good design, if it results in a lot of interrupts.

On the patch itself: Making the sleeps in vacuum uninterruptible means
that vacuum will be more slow to respond to interrupts. If you SIGTERM a
vacuum process, or hit CTRL-C, you *would* want to exit the sleep ASAP.

Tom raised that concern earlier in this thread
(https://www.postgresql.org/message-id/2100439.1719610468%40sss.pgh.pa.us)
but it seems the discussion wandered off to the details of how to do the
sleep, and left that unaddressed.

--
Heikki Linnakangas
Neon (https://neon.tech)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Paul Jungwirth 2024-08-12 21:15:23 Re: format_datum debugging function
Previous Message Imseih (AWS), Sami 2024-08-12 20:51:35 Re: Restart pg_usleep when interrupted