Jul 2024

2 commits
Avoid 0-length memcpy to NULL with EXEC_BACKEND
3 Jul 2024Heikki Linnakangasmaster18beta1REL_19_STABLE18beta1REL_18_STABLE18beta1REL_17_STABLE17beta3
LLM analysis, 100% surewritten from the discussion, no matching patch1 of 1 reviewer saw the final version

Adds the startup_data_len guard around memcpy() in launch_backend.c proposed inline with Thomas Munro's UBSan report in #61; #63 confirms the fix.

  • Thomas Munrosaw the final versionLLM analysis, 99% sureReported the EXEC_BACKEND UBSan failure and supplied the exact guard adopted by the commit in #61.
Tighten check for --forkchild argument when spawning child process
3 Jul 2024Heikki Linnakangasmaster18beta1REL_19_STABLE18beta1REL_18_STABLE18beta1REL_17_STABLE17beta3
LLM analysis, 100% surelanded as postedfrom patchset #621 of 1 reviewer saw the final version

The stable patch ID matches Nathan Bossart's attachment in #62, changing main() from matching --fork to matching --forkchild.

  • Heikki Linnakangassaw the final versioncommittercommitted the patch

Feb - Mar 2024

15 commits
Remove assertions that some compiler say are tautological
20 Mar 2024Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 100% surewritten from the discussion, no matching patch1 of 1 reviewer saw the final version

Removes the child-type range assertions in launch_backend.c following Tom Lane's compiler-warning report and recommendation in #55, confirmed in #56.

  • Tom Lanesaw the final versionLLM analysis, 99% sureIdentified tautological enum comparisons in the landed version of #53 and recommended deleting the assertions in #55.
Move code for backend startup to separate file
18 Mar 2024Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 99% suremodified before commitlight changesfrom patchset #532 of 2 reviewers saw the final version

Matches the backend_startup.c extraction in #53, with comment and declaration cleanup and adaptation to intervening authentication-code changes; #54 reports final cosmetic cleanup.

  • Tristan Partinsaw the final versiontrailerReviewed the startup code and the later extraction in #19 and #52, followed by light cleanup of this file-move patch.
  • Andres Freundsaw the final versiontrailerReviewed the startup code and proposed moving BackendMain out of postmaster.c in #20, which this mechanical extraction implements.
Refactor postmaster child process launching
18 Mar 2024Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 99% suremodified before commitmoderate changesfrom patchset #530 of 2 reviewers saw the final version

Combines the auxiliary-process initialization and launch-refactor patches from #53, adding slot-sync launching, zeroed parameter allocation, cleanup paths, and revised startup-data ownership.

  • Tristan Partinsaw an earlier versiontrailerReviewed launch interfaces, startup-data names, and initialization naming in #2, #19, and #52, before the final memory-management and launch-path changes.
  • Andres Freundsaw an earlier versiontrailerProposed designated child-type indexes, smaller mechanical patches, and reuse of BackendType in #3 and #20, before substantial later implementation changes.
Move some functions from postmaster.c to a new source file
18 Mar 2024Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 99% suremodified before commitlight changesfrom patchset #532 of 2 reviewers saw the final version

Matches the launch_backend.c extraction in #53, with introductory-comment cleanup and removal of a stale Windows local declaration.

  • Tristan Partinsaw the final versiontrailerReviewed the moved launch code in #19 and #52, with only light cleanup following for this extraction.
  • Andres Freundsaw the final versiontrailerRequested splitting mechanical file movement from behavioral changes in #20, which this patch does.
Split registration of Win32 deadchild callback to separate function
18 Mar 2024Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 100% suremodified before commitlight changesfrom patchset #532 of 2 reviewers saw the final version

Implements the Win32 callback extraction in #53, additionally deleting the now-unused childinfo declaration from internal_forkexec().

  • Tristan Partinsaw the final versiontrailerReviewed the remaining launch-series patches in #52, after this callback extraction was already separated.
  • Andres Freundsaw the final versiontrailerReviewed the original launch changes and requested separate mechanical refactoring in #20, before this behavior-preserving extraction.
Improve log messages referring to background worker processes
15 Mar 2024Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 100% surelanded as postedfrom patchset #531 of 1 reviewer saw the final version

The stable patch ID exactly matches the background-worker log-message patch in #53.

  • Tristan Partinsaw the final versionLLM analysis, 100% sureRequested adding 'background' to the worker error message in #52, and #53 explicitly adopts that suggestion.
Move initialization of the Port struct to the child process
12 Mar 2024Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 99% suremodified before commitmoderate changesfrom patchset #490 of 2 reviewers saw the final version

Combines the ConnCreate/ConnFree removal and ClientSocket patches from #49, placing Port allocation in pq_init() and omitting the local address from ClientSocket as explained in #53.

  • Tristan Partinsaw an earlier versiontrailerDeclared the first three patches ready in #52, before initialization was moved into pq_init() and the ClientSocket contents changed.
  • Andres Freundsaw an earlier versiontrailerReviewed Port compatibility and process-startup organization in #3 and #20, before the final allocation and socket-initialization revisions.
Pass CAC as an argument to the backend process
12 Mar 2024Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 100% surelanded as postedfrom patchset #492 of 2 reviewers saw the final version

The stable patch ID matches the CAC-argument patch in #49, removing canAcceptConnections from Port and passing it separately.

  • Tristan Partinsaw the final versiontrailerRequested CAC rationale and naming clarification in #2 and #19, then endorsed this patch in #52.
  • Andres Freundsaw the final versiontrailerReviewed the Port and startup changes in #3 and #20, with only light changes to the CAC-argument patch afterward.
Set socket options in child process after forking
12 Mar 2024Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 96% surewritten from the discussion, no matching patch

Moves getsockname() and socket-option setup from StreamConnection() to pq_init() in src/backend/libpq/pqcomm.c; this preparatory change is absent from the attachments and accompanies the final initialization redesign described in #53.

Fix references to renamed function in comments
5 Mar 2024Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 100% surewritten from the discussion, no matching patch1 of 1 reviewer saw the final version

Corrects stale pgstat_get_beentry_by_backend_id references in backend_status.c following Richard Guo's report in #50, confirmed in #51.

  • Richard Guosaw the final versionLLM analysis, 99% sureIdentified stale function names left by the ProcNumber conversion and specified their replacement in #50.
Use MyBackendType in more places to check what process this is
4 Mar 2024Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 99% suremodified before commitmoderate changesfrom patchset #420 of 1 reviewer saw the final version

Matches the MyBackendType process-check conversion last attached in #42, extending it to the subsequently introduced slot-sync worker and its IsLogicalSlotSyncWorker() checks.

  • Andres Freundsaw an earlier versiontrailerReviewed the Am*Process macro design in #36, before the final patch added slot-sync-worker coverage.
Remove MyAuxProcType, use MyBackendType instead
4 Mar 2024Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 99% suremodified before commitmoderate changesfrom patchset #420 of 2 reviewers saw the final version

Matches the AuxProcType removal last attached in #42, rebased over direct StartChildProcess calls and slot-sync support, with an additional BACKEND_NUM_TYPES correction to use B_LOGGER.

  • Reid Thompsonsaw an earlier versiontrailerQuestioned the enum-order dependency in #40, prompting removal of IsAuxProcess before later enum-bound and integration changes.
  • Andres Freundsaw an earlier versiontrailerReviewed the enum unification and auxiliary-process indexing in #36, before the indexing redesign and final enum-bound fix.
Replace BackendIds with 0-based ProcNumbers
3 Mar 2024Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 95% surelanded as postedfrom patchset #471 of 1 reviewer saw the final version

Matches the ProcNumber conversion in #47 modulo formatting and rebasing the rename over the newly added VXID reset in the preceding commit.

  • Andres Freundsaw the final versiontrailerReviewed zero-based indexing and recommended consistent MyProcNumber naming in #43 and #45, which the final version implements with mechanical renaming.
Redefine backend ID to be an index into the proc array
3 Mar 2024Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 99% suremodified before commitmoderate changesfrom patchset #470 of 2 reviewers saw the final version

Matches the backend-ID redefinition in #47, with additional clearing of proc->vxid fields during process cleanup and comment/formatting corrections.

  • Andres Freundsaw an earlier versiontrailerReviewed locking, invalid IDs, sinval scanning, and indexing in #43 and #45, before the final cleanup-state changes.
  • Reid Thompsonsaw an earlier versiontrailerReviewed the auxiliary-process enum portion of the combined series in #40, before the prepared-transaction and sinval revisions.
Remove superfluous 'pgprocno' field from PGPROC
21 Feb 2024Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 100% suremodified before commitlight changesfrom patchset #441 of 1 reviewer saw the final version

Matches the pgprocno-removal patch in #44, adding comments explaining pointer-derived process numbers and lock safety in src/include/storage/lock.h.

  • Andres Freundsaw the final versiontrailerAnalyzed pointer-arithmetic costs and tested hot paths in #43 and #45, after which only comments changed for this patch.

Jan 2024

1 commit
Fix incorrect comment on how BackendStatusArray is indexed
17 Jan 2024Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1REL_16_STABLE16.2REL_15_STABLE15.6REL_14_STABLE14.11
LLM analysis, 100% surelanded as postedfrom patchset #35

The stable patch ID matches the BackendStatusArray indexing-comment correction in #35.

Nov - Dec 2023

6 commits
Refactor how InitProcess is called
3 Dec 2023Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 100% surelanded as postedfrom patchset #263 of 3 reviewers saw the final version

The stable patch ID matches the InitProcess refactor in #26, including shared-memory attachment inside process initialization.

  • Tristan Partinsaw the final versiontrailerDeclared the initialization patches committable in #19, with only explanatory comments subsequently added to this patch.
  • Andres Freundsaw the final versiontrailerReviewed initialization ordering and requested the attachment-order explanation in #3 and #20.
  • Alexander Lakhinsaw the final versiontrailerRan the submitted initialization series under Valgrind with EXEC_BACKEND and reported results in #27 and #32.
Pass BackgroundWorker entry in the parameter file in EXEC_BACKEND mode
3 Dec 2023Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 100% suremodified before commitmoderate changesfrom patchset #260 of 3 reviewers saw the final version

Squashes the two BackgroundWorker-passing patches in #26, renames has_worker to has_bgworker, and adds MCXT_ALLOC_ZERO in bgworker.c as documented in #33.

  • Tristan Partinsaw an earlier versiontrailerReviewed the explicit worker-presence flag and suggested its clearer name in #28, before zero-initialization was added.
  • Andres Freundsaw an earlier versiontrailerReviewed worker startup and requested exact argument comparisons in #20, before the explicit-argument and padding fixes.
  • Alexander Lakhinsaw an earlier versiontrailerFound the worker-padding Valgrind failure in #32, which led to the additional allocation-zeroing change.
Refactor CreateSharedMemoryAndSemaphores
3 Dec 2023Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 100% surelanded as postedfrom patchset #262 of 2 reviewers saw the final version

The stable patch ID matches the shared-memory refactor in both #18 and #26; the latter is the latest matching submission.

  • Tristan Partinsaw the final versiontrailerDeclared the shared-memory and initialization patches committable in #19.
  • Andres Freundsaw the final versiontrailerRequested separating creation from attachment in #3 and reviewed the resulting split in #20, withdrawing the additional split suggestion in #25.
Silence Valgrind complaint with EXEC_BACKEND
1 Dec 2023Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 100% surewritten from the discussion, no matching patch1 of 1 reviewer saw the final version

Adds memset() for BackendParameters padding in internal_forkexec(), addressing the pre-existing EXEC_BACKEND Valgrind failure reported in #27 and explained in #29.

  • Alexander Lakhinsaw the final versionLLM analysis, 100% sureReported the uninitialized-padding failure and tested a memset-based remedy in #27, before the standalone fix was committed.
Adjust obsolete comment explaining set_stack_base().
1 Dec 2023Thomas Munromaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1REL_16_STABLE16.2
LLM analysis, 100% surewritten from the discussion, no matching patch3 of 3 reviewers saw the final version

Rewrites the obsolete set_stack_base() explanation following #21 and Thomas Munro's proposed rationale in #22, without a matching attachment.

  • Heikki Linnakangassaw the final versionLLM analysis, 90% sureFlagged the questionable stack-base explanation in the refactoring work at #18 and is explicitly credited as a reporter by the commit.
  • Tristan Partinsaw the final versionLLM analysis, 94% sureQuestioned unresolved explanatory comments during review in #19 and is explicitly credited as a reporter by the commit.
  • Andres Freundsaw the final versionLLM analysis, 100% sureExplained that signal-handler child launching had already been removed and identified the obsolete comment in #21.
Print lwlock stats also for aux processes, when built with LWLOCK_STATS
30 Nov 2023Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 100% surewritten from the discussion, no matching patch1 of 1 reviewer saw the final version

Adds InitLWLockAccess() to InitAuxiliaryProcess() following Andres Freund's observation in #20; #23 confirms the separate fix.

  • Andres Freundsaw the final versionLLM analysis, 100% sureIdentified the missing InitLWLockAccess() call while reviewing auxiliary-process initialization in #20.

Oct 2023

3 commits
Move canAcceptConnections check from ProcessStartupPacket to caller.
11 Oct 2023Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 100% surelanded as postedfrom patchset #11 of 1 reviewer saw the final version

The stable patch ID matches the original patch moving canAcceptConnections checks from ProcessStartupPacket() to its caller in #1.

  • Tristan Partinsaw the final versiontrailerReviewed the original preparatory patches and supported committing self-contained pieces separately in #2.
Fix crash on syslogger startup
6 Oct 2023Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 100% surewritten from the discussion, no matching patch1 of 1 reviewer saw the final version

Guards ListenSockets before freeing it in ClosePostmasterPorts(), directly fixing the syslogger NULL-pointer crash diagnosed in #13 and #14.

  • Michael Paquiersaw the final versionLLM analysis, 100% sureReproduced the syslogger crash and isolated pfree(NULL) with a detailed backtrace in #13 and #14.
Refactor ListenSocket array.
5 Oct 2023Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 100% suremodified before commitmoderate changesfrom patchset #11

Implements the counted ListenSockets array from #11, adding explicit freeing/resetting in ClosePostmasterPorts() and resetting the count in CloseServerPorts(), alongside comment cleanup.

Aug 2023

2 commits
Initialize ListenSocket array earlier.
29 Aug 2023Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1REL_16_STABLE16.0REL_15_STABLE15.5REL_14_STABLE14.10REL_13_STABLE13.13Also in: Logger process and "LOG: could not close client or listen socket: Bad file descriptor" (not this thread)
LLM analysis, 96% suremodified before commitmoderate changesfrom patchset #81 of 1 reviewer saw the final version

The commit revises the ListenSocket initialization move in #8 by placing it immediately before syslogger startup and moving CloseServerPorts registration alongside it, as requested in #9. Although thread #48355 claims the commit from its earlier #541178, this thread contains the later matching submission and subsequent refinement; under the latest-matching-patchset rule, attribution remains here, with Michael Paquier credited as author.

  • Heikki Linnakangassaw the final versioncommittercommitted the patch
Use FD_CLOEXEC on ListenSockets
24 Aug 2023Heikki Linnakangasmaster17beta1REL_19_STABLE17beta1REL_18_STABLE17beta1REL_17_STABLE17beta1
LLM analysis, 100% surelanded as postedfrom patchset #43 of 3 reviewers saw the final version

The stable patch ID exactly matches the standalone FD_CLOEXEC submission in #4, whose landing is confirmed in #6.

  • Tristan Partinsaw the final versiontrailerReviewed close-failure logging and suggested landing this preparatory patch separately in #2, before only light revisions.
  • Andres Freundsaw the final versiontrailerReviewed the original socket change and compared it with existing close-on-exec work in #3.
  • Thomas Munrosaw the final versiontrailerApproved the patch and reported successful FreeBSD EXEC_BACKEND testing in #5.

Credits across 29 commits

Author
Heikki LinnakangasLLM19
Michael Paquier1
Nathan Bossart1
Reviewer
Andres Freund15
Tristan Partin11
Alexander Lakhin2
Heikki Linnakangascommitter2
Reid Thompson2
Thomas Munro1
Reported by
Alexander Lakhin1
Andres Freund1
Heikki Linnakangas1
Michael Paquier1
Richard Guo1
Tristan Partin1
Committer
Heikki Linnakangas28
Thomas Munro1

N LLM means N of the credits come from LLM analysis, not from commit trailers.