Re: Refactoring backend fork+exec code

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: reid(dot)thompson(at)crunchydata(dot)com, Tristan Partin <tristan(at)neon(dot)tech>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Refactoring backend fork+exec code
Date: 2024-03-04 09:05:08
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I've now completed many of the side-quests, here are the patches that

The first three patches form a logical unit. They move the
initialization of the Port struct from postmaster to the backend
process. Currently, that work is split between the postmaster and the
backend process so that postmaster fills in the socket and some other
fields, and the backend process fills the rest after reading the startup
packet. With these patches, there is a new much smaller ClientSocket
struct that is passed from the postmaster to the child process, which
contains just the fields that postmaster initializes. The Port struct is
allocated in the child process. That makes the backend startup easier to
understand. I plan to commit those three patches next if there are no

That leaves the rest of the patches. I think they're in pretty good
shape too, and I've gotten some review on those earlier and have
addressed the comments I got so far, but would still appreciate another
round of review.

Heikki Linnakangas
Neon (

Attachment Content-Type Size
v12-0001-Pass-CAC-as-argument-to-backend-process.patch text/x-patch 5.6 KB
v12-0002-Remove-ConnCreate-and-ConnFree-and-allocate-Port.patch text/x-patch 3.9 KB
v12-0003-Move-initialization-of-Port-struct-to-child-proc.patch text/x-patch 27.5 KB
v12-0004-Extract-registration-of-Win32-deadchild-callback.patch text/x-patch 3.2 KB
v12-0005-Move-some-functions-from-postmaster.c-to-new-sou.patch text/x-patch 49.7 KB
v12-0006-Refactor-AuxProcess-startup.patch text/x-patch 8.6 KB
v12-0007-Refactor-postmaster-child-process-launching.patch text/x-patch 71.4 KB
v12-0008-Move-code-for-backend-startup-to-separate-file.patch text/x-patch 58.0 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2024-03-04 09:40:10 Re: remaining sql/json patches
Previous Message Bertrand Drouvot 2024-03-04 08:57:34 Re: Synchronizing slots from primary to standby