mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Remove support for background workers without BGWORKER_SHMEM_ACCESS.
Background workers without shared memory access have been broken on EXEC_BACKEND / windows builds since shortly after background workers have been introduced, without that being reported. Clearly they are not commonly used. The problem is that bgworker startup requires to be attached to shared memory in EXEC_BACKEND child processes. StartBackgroundWorker() detaches from shared memory for unconnected workers, but at that point we already have initialized subsystems referencing shared memory. Fixing this problem is not entirely trivial, so removing the option to not be connected to shared memory seems the best way forward. In most use cases the advantages of being connected to shared memory far outweigh the disadvantages. As there have been no reports about this issue so far, we have decided that it is not worth trying to address the problem in the back branches. Per discussion with Alvaro Herrera, Robert Haas and Tom Lane. Author: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/20210802065116.j763tz3vz4egqy3w@alap3.anarazel.de
This commit is contained in:
@ -11,8 +11,8 @@
|
||||
PostgreSQL can be extended to run user-supplied code in separate processes.
|
||||
Such processes are started, stopped and monitored by <command>postgres</command>,
|
||||
which permits them to have a lifetime closely linked to the server's status.
|
||||
These processes have the option to attach to <productname>PostgreSQL</productname>'s
|
||||
shared memory area and to connect to databases internally; they can also run
|
||||
These processes are attached to <productname>PostgreSQL</productname>'s
|
||||
shared memory area and have the option to connect to databases internally; they can also run
|
||||
multiple transactions serially, just like a regular client-connected server
|
||||
process. Also, by linking to <application>libpq</application> they can connect to the
|
||||
server and behave like a regular client application.
|
||||
@ -89,11 +89,7 @@ typedef struct BackgroundWorker
|
||||
<listitem>
|
||||
<para>
|
||||
<indexterm><primary>BGWORKER_SHMEM_ACCESS</primary></indexterm>
|
||||
Requests shared memory access. Workers without shared memory access
|
||||
cannot access any of <productname>PostgreSQL's</productname> shared
|
||||
data structures, such as heavyweight or lightweight locks, shared
|
||||
buffers, or any custom data structures which the worker itself may
|
||||
wish to create and use.
|
||||
Requests shared memory access. This flag is required.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
Reference in New Issue
Block a user