summaryrefslogtreecommitdiff
path: root/src/backend/storage/ipc/ipci.c
diff options
context:
space:
mode:
authorHeikki Linnakangas2024-07-29 12:37:48 +0000
committerHeikki Linnakangas2024-07-29 12:37:48 +0000
commit9d9b9d46f3c509c722ebbf2a1e7dc6296a6c711d (patch)
tree450cf30fdaca9dd1b5336179f2bb590e397fb9f0 /src/backend/storage/ipc/ipci.c
parent19de089cdc23373e2f36916017a1e23e8ff4c2f8 (diff)
Move cancel key generation to after forking the backend
Move responsibility of generating the cancel key to the backend process. The cancel key is now generated after forking, and the backend advertises it in the ProcSignal array. When a cancel request arrives, the backend handling it scans the ProcSignal array to find the target pid and cancel key. This is similar to how this previously worked in the EXEC_BACKEND case with the ShmemBackendArray, just reusing the ProcSignal array. One notable change is that we no longer generate cancellation keys for non-backend processes. We generated them before just to prevent a malicious user from canceling them; the keys for non-backend processes were never actually given to anyone. There is now an explicit flag indicating whether a process has a valid key or not. I wrote this originally in preparation for supporting longer cancel keys, but it's a nice cleanup on its own. Reviewed-by: Jelte Fennema-Nio Discussion: https://www.postgresql.org/message-id/[email protected]
Diffstat (limited to 'src/backend/storage/ipc/ipci.c')
-rw-r--r--src/backend/storage/ipc/ipci.c11
1 files changed, 0 insertions, 11 deletions
diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c
index ca930af08f2..b6c3b169509 100644
--- a/src/backend/storage/ipc/ipci.c
+++ b/src/backend/storage/ipc/ipci.c
@@ -152,9 +152,6 @@ CalculateShmemSize(int *num_semaphores)
size = add_size(size, WaitEventCustomShmemSize());
size = add_size(size, InjectionPointShmemSize());
size = add_size(size, SlotSyncShmemSize());
-#ifdef EXEC_BACKEND
- size = add_size(size, ShmemBackendArraySize());
-#endif
/* include additional requested shmem from preload libraries */
size = add_size(size, total_addin_request);
@@ -244,14 +241,6 @@ CreateSharedMemoryAndSemaphores(void)
/* Initialize subsystems */
CreateOrAttachShmemStructs();
-#ifdef EXEC_BACKEND
-
- /*
- * Alloc the win32 shared backend array
- */
- ShmemBackendArrayAllocation();
-#endif
-
/* Initialize dynamic shared memory facilities. */
dsm_postmaster_startup(shim);