summaryrefslogtreecommitdiff
path: root/src/backend/utils/init/postinit.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-05-27 05:37:50 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-05-27 05:37:50 +0000
commit8d675c85c58065076b673ea8ee61fa1285748ee3 (patch)
treec7ac138248ac058c3f93f4dba27276e33958b5ef /src/backend/utils/init/postinit.c
parent77947c51c08179b8bc12347a7fbcb2c8d7908302 (diff)
pgstat's on-proc-exit hook has to execute after the last transaction commit
or abort within a backend; rearrange InitPostgres processing to make it so. Revealed by just-added Asserts along with ECPG regression tests (hm, I wonder why the core regression tests didn't expose it?). This possibly is another reason for missing stats updates ...
Diffstat (limited to 'src/backend/utils/init/postinit.c')
-rw-r--r--src/backend/utils/init/postinit.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index daef3199fa6..ff70c8d6a66 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.175 2007/03/13 00:33:42 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.176 2007/05/27 05:37:49 tgl Exp $
*
*
*-------------------------------------------------------------------------
@@ -435,6 +435,10 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
/* Initialize portal manager */
EnablePortalManager();
+ /* Initialize stats collection --- must happen before first xact */
+ if (!bootstrap)
+ pgstat_initialize();
+
/*
* Set up process-exit callback to do pre-shutdown cleanup. This has to
* be after we've initialized all the low-level modules like the buffer
@@ -587,7 +591,7 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
/* initialize client encoding */
InitializeClientEncoding();
- /* initialize statistics collection for this backend */
+ /* report this backend in the PgBackendStatus array */
if (!bootstrap)
pgstat_bestart();