diff options
author | Andres Freund | 2025-03-18 14:52:33 +0000 |
---|---|---|
committer | Andres Freund | 2025-03-18 15:54:01 +0000 |
commit | 247ce06b883d7b3a40d08312dc03dfb37fbff212 (patch) | |
tree | 6e45be6994fa574c077c32ab316eb9579d67519e /src/include | |
parent | 55b454d0e14084c841a034073abbf1a0ea937a45 (diff) |
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/include')
-rw-r--r-- | src/include/storage/aio.h | 5 | ||||
-rw-r--r-- | src/include/storage/aio_internal.h | 1 | ||||
-rw-r--r-- | src/include/storage/lwlocklist.h | 1 |
3 files changed, 5 insertions, 2 deletions
diff --git a/src/include/storage/aio.h b/src/include/storage/aio.h index f48a4962089..7b6b7d20a85 100644 --- a/src/include/storage/aio.h +++ b/src/include/storage/aio.h @@ -27,10 +27,11 @@ typedef enum IoMethod { IOMETHOD_SYNC = 0, + IOMETHOD_WORKER, } IoMethod; -/* We'll default to synchronous execution. */ -#define DEFAULT_IO_METHOD IOMETHOD_SYNC +/* We'll default to worker based execution. */ +#define DEFAULT_IO_METHOD IOMETHOD_WORKER /* diff --git a/src/include/storage/aio_internal.h b/src/include/storage/aio_internal.h index 0ba3c4f1476..108fe61c7b4 100644 --- a/src/include/storage/aio_internal.h +++ b/src/include/storage/aio_internal.h @@ -385,6 +385,7 @@ extern PgAioHandle *pgaio_inj_io_get(void); /* Declarations for the tables of function pointers exposed by each IO method. */ extern PGDLLIMPORT const IoMethodOps pgaio_sync_ops; +extern PGDLLIMPORT const IoMethodOps pgaio_worker_ops; extern PGDLLIMPORT const IoMethodOps *pgaio_method_ops; extern PGDLLIMPORT PgAioCtl *pgaio_ctl; diff --git a/src/include/storage/lwlocklist.h b/src/include/storage/lwlocklist.h index cf565452382..932024b1b0b 100644 --- a/src/include/storage/lwlocklist.h +++ b/src/include/storage/lwlocklist.h @@ -83,3 +83,4 @@ PG_LWLOCK(49, WALSummarizer) PG_LWLOCK(50, DSMRegistry) PG_LWLOCK(51, InjectionPoint) PG_LWLOCK(52, SerialControl) +PG_LWLOCK(53, AioWorkerSubmissionQueue) |