Re: Sub-millisecond [autovacuum_]vacuum_cost_delay broken
Thomas Munro <thomas.munro@gmail.com>
From: Thomas Munro <thomas.munro@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Nathan Bossart <nathandbossart@gmail.com>,
Melanie Plageman <melanieplageman@gmail.com>, Pg Hackers <pgsql-hackers@postgresql.org>, Stephen Frost <sfrost@snowman.net>
Date: 2023-03-10T05:58:29Z
Lists: pgsql-hackers
Attachments
- 0001-Support-microsecond-based-timeouts-in-WaitEventSet-A.patch (text/x-patch) patch 0001
- 0002-Use-microsecond-based-naps-for-vacuum_cost_delay-sle.patch (text/x-patch) patch 0002
- 0003-Use-microsecond-based-naps-in-walreceiver.patch (text/x-patch) patch 0003
- 0004-Provide-fallback-implementation-of-vacuum_cost_delay.patch (text/x-patch) patch 0004
On Fri, Mar 10, 2023 at 2:45 PM Thomas Munro <thomas.munro@gmail.com> wrote: > I'll go and see about usec latch waits. More soon. Here are some experimental patches along those lines. Seems good locally, but I saw a random failure I don't understand on CI so apparently I need to find a bug; at least this gives an idea of how this might look. Unfortunately, the new interface on Linux turned out to be newer that I first realised: Linux 5.11+ (so RHEL 9, Debian 12/Bookworm, Ubuntu 21.04/Hirsute Hippo), so unless we're OK with it taking a couple more years to be more widely used, we'll need some fallback code. Perhaps something like 0004, which also shows the sort of thing that we might consider back-patching to 14 and 15 (next revision I'll move that up the front and put it in back-patchable form). It's not exactly beautiful; maybe sharing code with recovery's lazy PM-exit detection could help. Of course, the new μs-based wait API could be used wherever we do timestamp-based waiting, for no particular reason other than that it is the resolution of our timestamps, so there is no need to bother rounding; I doubt anyone would notice or care much about that, but it's vote in favour of μs rather than the other obvious contender ns, which modern underlying kernel primitives are using.
Commits
-
Use nanosleep() to implement pg_usleep().
- a948e49e2ef1 16.0 landed
-
Update obsolete comment about pg_usleep() accuracy.
- e4da2a44c17a 16.0 landed
-
Fix fractional vacuum_cost_delay.
- 2bef57ee8b38 14.8 landed
- d9c9c43af5c8 15.3 landed
- 720de00af49d 16.0 landed