aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2021-09-15 13:16:00 -0700
committerAndres Freund <andres@anarazel.de>2021-09-15 13:17:12 -0700
commit2c7615f77b8d84130d304365aa2235eea7b5949c (patch)
treed3959e9b53530836d7db8d3db0e21d12ce161f05 /src/backend/tcop/postgres.c
parente3ec3c00d85bd2844ffddee83df2bd67c4f8297f (diff)
downloadpostgresql-2c7615f77b8d84130d304365aa2235eea7b5949c.tar.gz
postgresql-2c7615f77b8d84130d304365aa2235eea7b5949c.zip
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
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r--src/backend/tcop/postgres.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 3f9ed549f92..82d22e4eed7 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -4052,6 +4052,12 @@ PostgresMain(int argc, char *argv[],
InitializeMaxBackends();
CreateSharedMemoryAndSemaphores();
+
+ /*
+ * Remember stand-alone backend startup time, roughly at the same
+ * point during startup that postmaster does so.
+ */
+ PgStartTime = GetCurrentTimestamp();
}
/*
@@ -4162,12 +4168,6 @@ PostgresMain(int argc, char *argv[],
MemoryContextSwitchTo(TopMemoryContext);
/*
- * Remember stand-alone backend startup time
- */
- if (!IsUnderPostmaster)
- PgStartTime = GetCurrentTimestamp();
-
- /*
* POSTGRES main processing loop begins here
*
* If an exception is encountered, processing resumes here so we abort the