Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3d7c752

Browse files
committed
process startup: Do InitProcess() at the same time regardless of EXEC_BACKEND.
An upcoming patch splits single user mode into its own function. This makesthat easier. Split out for easier review / testing.Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com>Author: Andres Freund <andres@anarazel.de>Discussion:https://postgr.es/m/20210802164124.ufo5buo4apl6yuvs@alap3.anarazel.de
1 parent37a9aa6 commit3d7c752

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4275,6 +4275,15 @@ BackendStartup(Port *port)
42754275
/* Perform additional initialization and collect startup packet */
42764276
BackendInitialize(port);
42774277

4278+
/*
4279+
* Create a per-backend PGPROC struct in shared memory. We must do
4280+
* this before we can use LWLocks. In the !EXEC_BACKEND case (here)
4281+
* this could be delayed a bit further, but EXEC_BACKEND needs to do
4282+
* stuff with LWLocks before PostgresMain(), so we do it here as well
4283+
* for symmetry.
4284+
*/
4285+
InitProcess();
4286+
42784287
/* And run the backend */
42794288
BackendRun(port);
42804289
}

‎src/backend/tcop/postgres.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4058,20 +4058,13 @@ PostgresMain(int argc, char *argv[],
40584058
* point during startup that postmaster does so.
40594059
*/
40604060
PgStartTime=GetCurrentTimestamp();
4061-
}
40624061

4063-
/*
4064-
* Create a per-backend PGPROC struct in shared memory, except in the
4065-
* EXEC_BACKEND case where this was done in SubPostmasterMain. We must do
4066-
* this before we can use LWLocks (and in the EXEC_BACKEND case we already
4067-
* had to do some stuff with LWLocks).
4068-
*/
4069-
#ifdefEXEC_BACKEND
4070-
if (!IsUnderPostmaster)
4062+
/*
4063+
* Create a per-backend PGPROC struct in shared memory. We must do
4064+
* this before we can use LWLocks.
4065+
*/
40714066
InitProcess();
4072-
#else
4073-
InitProcess();
4074-
#endif
4067+
}
40754068

40764069
/* Early initialization */
40774070
BaseInit();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp