pgsql: aio: Add io_method=worker

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: aio: Add io_method=worker
Date: 2025-03-18 16:01:44
Message-ID: E1tuZNw-0037Gu-00@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

aio: Add io_method=worker

The previous commit introduced the infrastructure to start io_workers. This
commit actually makes the workers execute IOs.

IO workers consume IOs from a shared memory submission queue, run traditional
synchronous system calls, and perform the shared completion handling
immediately. Client code submits most requests by pushing IOs into the
submission queue, and waits (if necessary) using condition variables. Some
IOs cannot be performed in another process due to lack of infrastructure for
reopening the file, and must processed synchronously by the client code when
submitted.

For now the default io_method is changed to "worker". We should re-evaluate
that around beta1, we might want to be careful and set the default to "sync"
for 18.

Reviewed-by: Noah Misch <noah(at)leadboat(dot)com>
Co-authored-by: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Co-authored-by: Andres Freund <andres(at)anarazel(dot)de>
Discussion: https://postgr.es/m/uvrtrknj4kdytuboidbhwclo4gxhswwcpgadptsjvjqcluzmah%40brqs62irg4dt
Discussion: https://postgr.es/m/20210223100344.llw5an2aklengrmn@alap3.anarazel.de
Discussion: https://postgr.es/m/stj36ea6yyhoxtqkhpieia2z4krnam7qyetc57rfezgk4zgapf@gcnactj4z56m

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/247ce06b883d7b3a40d08312dc03dfb37fbff212

Modified Files
--------------
doc/src/sgml/config.sgml | 5 +
src/backend/storage/aio/aio.c | 2 +
src/backend/storage/aio/aio_init.c | 9 +
src/backend/storage/aio/method_worker.c | 445 +++++++++++++++++++++++-
src/backend/utils/activity/wait_event_names.txt | 1 +
src/backend/utils/misc/postgresql.conf.sample | 2 +-
src/include/storage/aio.h | 5 +-
src/include/storage/aio_internal.h | 1 +
src/include/storage/lwlocklist.h | 1 +
src/tools/pgindent/typedefs.list | 3 +
10 files changed, 466 insertions(+), 8 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Álvaro Herrera 2025-03-18 17:58:30 pgsql: Introduce squashing of constant lists in query jumbling
Previous Message Andres Freund 2025-03-18 16:01:43 pgsql: aio: Infrastructure for io_method=worker