Reserve a PGPROC slot and semaphore for the slotsync worker process. The need for this was missed in commit 93db6cbda, with the result being that if we launch a slotsync worker it would consume one of the PGPROCs in the max_connections pool. That could lead to inability to launch the worker, or to subsequent failures of connection requests that should have succeeded according to the configured settings.
Rather than create some one-off infrastructure to support this, let's group the slotsync worker with the existing autovac launcher in a new category of "special worker" processes. These are kind of like auxiliary processes, but they cannot use that infrastructure because they need to be able to run transactions. For the moment, make these processes share the PGPROC freelist used for autovac workers (which previously supplied the autovac launcher too). This is partly to avoid an ABI change in v17, and partly because it seems silly to have a freelist with at most two members. This might be worth revisiting if we grow enough workers in this category. Tom Lane and Hou Zhijie. Back-patch to v17. Discussion: https://postgr.es/m/1808397.1735156...@sss.pgh.pa.us Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/14141bbbc103bf5db41c8f9a8206dfc9ca626e9f Modified Files -------------- src/backend/storage/lmgr/proc.c | 37 +++++++++++++++++++++---------------- src/backend/utils/init/postinit.c | 6 +++--- src/include/miscadmin.h | 9 +++++++-- src/include/storage/proc.h | 14 ++++++++++++-- 4 files changed, 43 insertions(+), 23 deletions(-)