| From: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
|---|---|
| To: | Dmitry Dolgov <9erthalion6(at)gmail(dot)com> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Automatically sizing the IO worker pool |
| Date: | 2026-04-06 15:02:52 |
| Message-ID: | CA+hUKGLUZ51zkxUoBvANcLdvz8DjS_85=6985HE8gLuNtBxX7Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Here's an updated patch. It's mostly just rebased over the recent
firehose, but with lots of comments and a few names (hopefully)
improved. There is one code change to highlight though:
maybe_start_io_workers() knows when it's not allowed to create new
workers, an interesting case being FatalError before we have started
the new world. The previous coding of DetermineSleepTime() didn't
know about that, so it could return 0 (don't sleep), and then the
postmaster could busy-wait for restart progress. Maybe there were
other cases like that, but in general DetermineSleepTime() and
maybe_start_io_workers() really need to be 100% in agreement. So I
have moved that knowledge into a new function
maybe_start_io_workers_scheduled_at(). Both DetermineSleepTime() and
maybe_start_io_workers() call that so there is a single source of
truth.
I think I got confused about that because it's not that obvious why
the existing code doesn't test FatalError.
I thought of a slightly bigger refactoring that might deconfuse
DetermineSleepTime() a bit more. Probably material for the next
cycle, but basically the idea is to stop using a bunch of different
conditions and different units of time and convert the whole thing to
a simple find-the-lowest-time function. I kept that separate.
I'll post a new version of the patch that was v3-0002 separately.
| Attachment | Content-Type | Size |
|---|---|---|
| v4-0002-Refactor-the-postmaster-s-periodic-job-scheduling.patch | text/x-patch | 14.9 KB |
| v4-0001-aio-Adjust-I-O-worker-pool-size-automatically.patch | text/x-patch | 42.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2026-04-06 15:03:57 | Re: PG 19 release notes and authors |
| Previous Message | Josh Kupershmidt | 2026-04-06 14:57:56 | Adding event mask validation for ModifyWaitEvent |