git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e3ec3c0)
process startup: Initialize PgStartTime earlier in single user mode.
2021年9月15日 20:16:00 +0000 (13:16 -0700)
2021年9月15日 20:17:12 +0000 (13:17 -0700)
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


diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 3f9ed549f9221b34acccd8ceaf7f368529968506..82d22e4eed76754f1bb7beca7152a367c08bd2a5 100644 (file)
--- 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();
}
/*
@@ -4161,12 +4167,6 @@ PostgresMain(int argc, char *argv[],
initStringInfo(&row_description_buf);
MemoryContextSwitchTo(TopMemoryContext);
- /*
- * Remember stand-alone backend startup time
- */
- if (!IsUnderPostmaster)
- PgStartTime = GetCurrentTimestamp();
-
/*
* POSTGRES main processing loop begins here
*
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /