summaryrefslogtreecommitdiff
path: root/src/include/pgstat.h
diff options
context:
space:
mode:
authorRobert Haas2014-02-25 17:34:04 +0000
committerRobert Haas2014-02-25 17:34:04 +0000
commitdd1a3bccca241a998b4ebf39d67202698e5fa599 (patch)
treeac25477cab559d842e406a1f6ba878257c694dc4 /src/include/pgstat.h
parent278c94209b90b8e241f64ea4ce2d955b63b1f5d7 (diff)
Show xid and xmin in pg_stat_activity and pg_stat_replication.
Christian Kruse, reviewed by Andres Freund and myself, with further minor adjustments by me.
Diffstat (limited to 'src/include/pgstat.h')
-rw-r--r--src/include/pgstat.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index 5b2e4609f65..932c83d79e5 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -735,6 +735,34 @@ typedef struct PgBackendStatus
char *st_activity;
} PgBackendStatus;
+/* ----------
+ * LocalPgBackendStatus
+ *
+ * When we build the backend status array, we use LocalPgBackendStatus to be
+ * able to add new values to the struct when needed without adding new fields
+ * to the shared memory. It contains the backend status as a first member.
+ * ----------
+ */
+typedef struct LocalPgBackendStatus
+{
+ /*
+ * Local version of the backend status entry.
+ */
+ PgBackendStatus backendStatus;
+
+ /*
+ * The xid of the current transaction if available, InvalidTransactionId
+ * if not.
+ */
+ TransactionId backend_xid;
+
+ /*
+ * The xmin of the current session if available, InvalidTransactionId
+ * if not.
+ */
+ TransactionId backend_xmin;
+} LocalPgBackendStatus;
+
/*
* Working state needed to accumulate per-function-call timing statistics.
*/
@@ -907,6 +935,7 @@ extern void pgstat_send_bgwriter(void);
extern PgStat_StatDBEntry *pgstat_fetch_stat_dbentry(Oid dbid);
extern PgStat_StatTabEntry *pgstat_fetch_stat_tabentry(Oid relid);
extern PgBackendStatus *pgstat_fetch_stat_beentry(int beid);
+extern LocalPgBackendStatus *pgstat_fetch_stat_local_beentry(int beid);
extern PgStat_StatFuncEntry *pgstat_fetch_stat_funcentry(Oid funcid);
extern int pgstat_fetch_stat_numbackends(void);
extern PgStat_ArchiverStats *pgstat_fetch_stat_archiver(void);