diff options
author | Heikki Linnakangas | 2023-12-03 14:38:54 +0000 |
---|---|---|
committer | Heikki Linnakangas | 2023-12-03 14:38:54 +0000 |
commit | 388491f1e5e63fe97c7cca26d18b64321973d423 (patch) | |
tree | 5c74175b99ab8d9d6fcd13b4eb045e3e9f742a01 /src/backend/postmaster/bgworker.c | |
parent | 69d903367cdea188bf865f4edd72a186cda9e689 (diff) |
Pass BackgroundWorker entry in the parameter file in EXEC_BACKEND mode
The BackgroundWorker struct is now passed the same way as the Port
struct. Seems more consistent.
This makes it possible to move InitProcess later in SubPostmasterMain
(in next commit), as we no longer need to access shared memory to read
background worker entry.
Reviewed-by: Tristan Partin, Andres Freund, Alexander Lakhin
Discussion: https://www.postgresql.org/message-id/[email protected]
Diffstat (limited to 'src/backend/postmaster/bgworker.c')
-rw-r--r-- | src/backend/postmaster/bgworker.c | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c index 911bf24a7cb..d936986c2bf 100644 --- a/src/backend/postmaster/bgworker.c +++ b/src/backend/postmaster/bgworker.c @@ -350,7 +350,7 @@ BackgroundWorkerStateChange(bool allow_new_workers) */ rw = MemoryContextAllocExtended(PostmasterContext, sizeof(RegisteredBgWorker), - MCXT_ALLOC_NO_OOM); + MCXT_ALLOC_NO_OOM | MCXT_ALLOC_ZERO); if (rw == NULL) { ereport(LOG, @@ -631,27 +631,6 @@ ResetBackgroundWorkerCrashTimes(void) } } -#ifdef EXEC_BACKEND -/* - * In EXEC_BACKEND mode, workers use this to retrieve their details from - * shared memory. - */ -BackgroundWorker * -BackgroundWorkerEntry(int slotno) -{ - static BackgroundWorker myEntry; - BackgroundWorkerSlot *slot; - - Assert(slotno < BackgroundWorkerData->total_slots); - slot = &BackgroundWorkerData->slot[slotno]; - Assert(slot->in_use); - - /* must copy this in case we don't intend to retain shmem access */ - memcpy(&myEntry, &slot->worker, sizeof myEntry); - return &myEntry; -} -#endif - /* * Complain about the BackgroundWorker definition using error level elevel. * Return true if it looks ok, false if not (unless elevel >= ERROR, in |