aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/init/postinit.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2017-03-26 22:02:22 -0400
committerRobert Haas <rhaas@postgresql.org>2017-03-26 22:02:22 -0400
commitfc70a4b0df38bda6a13941f1581f25fbb643c7f3 (patch)
tree87ee4eec5f4bc96bacad8e8c5313abc5f9c3f367 /src/backend/utils/init/postinit.c
parent2f0903ea196503fc8af373a9de46b1e01a23508c (diff)
downloadpostgresql-fc70a4b0df38bda6a13941f1581f25fbb643c7f3.tar.gz
postgresql-fc70a4b0df38bda6a13941f1581f25fbb643c7f3.zip
Show more processes in pg_stat_activity.
Previously, auxiliary processes and background workers not connected to a database (such as the logical replication launcher) weren't shown. Include them, so that we can see the associated wait state information. Add a new column to identify the processes type, so that people can filter them out easily using SQL if they wish. Before this patch was written, there was discussion about whether we should expose this information in a separate view, so as to avoid contaminating pg_stat_activity with things people might not want to see. But putting everything in pg_stat_activity was a more popular choice, so that's what the patch does. Kuntal Ghosh, reviewed by Amit Langote and Michael Paquier. Some revisions and bug fixes by me. Discussion: http://postgr.es/m/CA+TgmoYES5nhkEGw9nZXU8_FhA8XEm8NTm3-SO+3ML1B81Hkww@mail.gmail.com
Diffstat (limited to 'src/backend/utils/init/postinit.c')
-rw-r--r--src/backend/utils/init/postinit.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index 9f938f2d270..b8b4a06350c 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -665,7 +665,12 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
/* The autovacuum launcher is done here */
if (IsAutoVacuumLauncherProcess())
+ {
+ /* report this backend in the PgBackendStatus array */
+ pgstat_bestart();
+
return;
+ }
/*
* Start a new transaction here before first access to db, and get a
@@ -874,7 +879,10 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
* transaction we started before returning.
*/
if (!bootstrap)
+ {
+ pgstat_bestart();
CommitTransactionCommand();
+ }
return;
}