Re: Refactoring backend fork+exec code

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Tristan Partin <tristan(at)neon(dot)tech>, Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: Refactoring backend fork+exec code
Date: 2023-12-01 12:10:03
Message-ID: 3b02a5a1-81ea-44e4-a09e-c0a594a4cef8@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 30/11/2023 20:44, Tristan Partin wrote:
> Patches 1-3 seem committable as-is.

Thanks for the review! I'm focusing on patches 1-3 now, and will come
back to the rest after committing 1-3.

There was one test failure with EXEC_BACKEND from patch 2, in
'test_shm_mq'. In restore_backend_variables() I checked if 'bgw_name' is
empty to decide if the BackgroundWorker struct is filled in or not, but
it turns out that 'test_shm_mq' doesn't fill in bgw_name. It probably
should, I think that's an oversight in 'test_shm_mq', but that's a
separate issue.

I did some more refactoring of patch 2, to fix that and to improve it in
general. The BackgroundWorker struct is now passed through the
fork-related functions similarly to the Port struct. That seems more
consistent.

Attached is new version of these patches. For easier review, I made the
new refactorings compared in a new commit 0003. I will squash that
before pushing, but this makes it easier to see what changed.

Barring any new feedback or issues, I will commit these.

--
Heikki Linnakangas
Neon (https://neon.tech)

Attachment Content-Type Size
v4-0001-Refactor-CreateSharedMemoryAndSemaphores.patch text/x-patch 10.3 KB
v4-0002-Pass-BackgroundWorker-entry-in-the-parameter-file.patch text/x-patch 5.6 KB
v4-0003-Refactor-how-MyBgWorkerEntry-is-passed-through-th.patch text/x-patch 10.0 KB
v4-0004-Refactor-how-InitProcess-is-called.patch text/x-patch 8.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nisha Moond 2023-12-01 12:10:33 Re: Synchronizing slots from primary to standby
Previous Message Daniel Gustafsson 2023-12-01 11:46:22 Re: pgsql: Clean up role created in new subscription test.