aio: Add io_method=worker
authorAndres Freund <andres@anarazel.de>
Tue, 18 Mar 2025 14:52:33 +0000 (10:52 -0400)
committerAndres Freund <andres@anarazel.de>
Tue, 18 Mar 2025 15:54:01 +0000 (11:54 -0400)
commit247ce06b883d7b3a40d08312dc03dfb37fbff212
tree6e45be6994fa574c077c32ab316eb9579d67519e
parent55b454d0e14084c841a034073abbf1a0ea937a45
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@leadboat.com>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Co-authored-by: Andres Freund <andres@anarazel.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
doc/src/sgml/config.sgml
src/backend/storage/aio/aio.c
src/backend/storage/aio/aio_init.c
src/backend/storage/aio/method_worker.c
src/backend/utils/activity/wait_event_names.txt
src/backend/utils/misc/postgresql.conf.sample
src/include/storage/aio.h
src/include/storage/aio_internal.h
src/include/storage/lwlocklist.h
src/tools/pgindent/typedefs.list