process startup: Split single user code out of PostgresMain().

Andres Freund <andres@anarazel.de>

Commit: 7c83a3bf51489e5b48c567c2ac54fed030d23c52
Author: Andres Freund <andres@anarazel.de>
Date: 2021-09-18T02:56:47Z
Releases: 15.0
process startup: Split single user code out of PostgresMain().

It was harder than necessary to understand PostgresMain() because the code for
a normal backend was interspersed with single-user mode specific code. Split
most of the single-user mode code into its own function
PostgresSingleUserMain(), that does all the necessary setup for single-user
mode, and then hands off after that to PostgresMain().

There still is some single-user mode code in InitPostgres(), and it'd likely
be worth moving at least some of it out. But that's for later.

Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Author: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/20210802164124.ufo5buo4apl6yuvs@alap3.anarazel.de

Files

PathChange+/−
src/backend/main/main.c modified +2 −3
src/backend/postmaster/postmaster.c modified +1 −7
src/backend/tcop/postgres.c modified +84 −68
src/include/tcop/tcopprot.h modified +3 −2

Discussion