diff options
author | Andres Freund <andres@anarazel.de> | 2025-03-18 10:52:33 -0400 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2025-03-18 11:54:01 -0400 |
commit | 247ce06b883d7b3a40d08312dc03dfb37fbff212 (patch) | |
tree | 6e45be6994fa574c077c32ab316eb9579d67519e /src/backend/storage/aio/aio.c | |
parent | 55b454d0e14084c841a034073abbf1a0ea937a45 (diff) | |
download | postgresql-247ce06b883d7b3a40d08312dc03dfb37fbff212.tar.gz postgresql-247ce06b883d7b3a40d08312dc03dfb37fbff212.zip |
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
Diffstat (limited to 'src/backend/storage/aio/aio.c')
-rw-r--r-- | src/backend/storage/aio/aio.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backend/storage/aio/aio.c b/src/backend/storage/aio/aio.c index 4d5439c73fd..3ed4b1dfdac 100644 --- a/src/backend/storage/aio/aio.c +++ b/src/backend/storage/aio/aio.c @@ -64,6 +64,7 @@ static void pgaio_io_wait(PgAioHandle *ioh, uint64 ref_generation); /* Options for io_method. */ const struct config_enum_entry io_method_options[] = { {"sync", IOMETHOD_SYNC, false}, + {"worker", IOMETHOD_WORKER, false}, {NULL, 0, false} }; @@ -80,6 +81,7 @@ PgAioBackend *pgaio_my_backend; static const IoMethodOps *const pgaio_method_ops_table[] = { [IOMETHOD_SYNC] = &pgaio_sync_ops, + [IOMETHOD_WORKER] = &pgaio_worker_ops, }; /* callbacks for the configured io_method, set by assign_io_method */ |