diff options
Diffstat (limited to 'src/backend/storage/aio/aio_init.c')
-rw-r--r-- | src/backend/storage/aio/aio_init.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/backend/storage/aio/aio_init.c b/src/backend/storage/aio/aio_init.c index 6fe55510fae..4e405ce7ca8 100644 --- a/src/backend/storage/aio/aio_init.c +++ b/src/backend/storage/aio/aio_init.c @@ -18,6 +18,7 @@ #include "storage/aio.h" #include "storage/aio_internal.h" #include "storage/aio_subsys.h" +#include "storage/io_worker.h" #include "storage/ipc.h" #include "storage/proc.h" #include "storage/shmem.h" @@ -39,6 +40,11 @@ AioCtlShmemSize(void) static uint32 AioProcs(void) { + /* + * While AIO workers don't need their own AIO context, we can't currently + * guarantee nothing gets assigned to the a ProcNumber for an IO worker if + * we just subtracted MAX_IO_WORKERS. + */ return MaxBackends + NUM_AUXILIARY_PROCS; } @@ -223,6 +229,9 @@ pgaio_init_backend(void) /* shouldn't be initialized twice */ Assert(!pgaio_my_backend); + if (MyBackendType == B_IO_WORKER) + return; + if (MyProc == NULL || MyProcNumber >= AioProcs()) elog(ERROR, "aio requires a normal PGPROC"); |