Skip to content

Commit 2c7615f

Browse files
committed
process startup: Initialize PgStartTime earlier in single user mode.
An upcoming patch splits single user mode handling out of PostgresMain(). The startup time only needs to be determined in single user mode. Currently the initialization happens late, which makes the split a bit harder. As postmaster determines the time earlier it makes sense to move the time for single user mode to a roughly similar point in time. Reviewd-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Author: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/20210802164124.ufo5buo4apl6yuvs@alap3.anarazel.de
1 parent e3ec3c0 commit 2c7615f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/backend/tcop/postgres.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4052,6 +4052,12 @@ PostgresMain(int argc, char *argv[],
40524052
InitializeMaxBackends();
40534053

40544054
CreateSharedMemoryAndSemaphores();
4055+
4056+
/*
4057+
* Remember stand-alone backend startup time, roughly at the same
4058+
* point during startup that postmaster does so.
4059+
*/
4060+
PgStartTime = GetCurrentTimestamp();
40554061
}
40564062

40574063
/*
@@ -4161,12 +4167,6 @@ PostgresMain(int argc, char *argv[],
41614167
initStringInfo(&row_description_buf);
41624168
MemoryContextSwitchTo(TopMemoryContext);
41634169

4164-
/*
4165-
* Remember stand-alone backend startup time
4166-
*/
4167-
if (!IsUnderPostmaster)
4168-
PgStartTime = GetCurrentTimestamp();
4169-
41704170
/*
41714171
* POSTGRES main processing loop begins here
41724172
*

0 commit comments

Comments
 (0)