summaryrefslogtreecommitdiff
path: root/src/include/pgstat.h
diff options
context:
space:
mode:
authorMagnus Hagander2011-01-03 11:46:03 +0000
committerMagnus Hagander2011-01-03 11:46:03 +0000
commit40d9e94bd7537144d3d379c1fd1264dff5cf4bb2 (patch)
treed7619d7a8393994adea064d6d67762b0f9f37037 /src/include/pgstat.h
parent1996b482859c67726e77b80a263d3cce954e022d (diff)
Add views and functions to monitor hot standby query conflicts
Add the view pg_stat_database_conflicts and a column to pg_stat_database, and the underlying functions to provide the information.
Diffstat (limited to 'src/include/pgstat.h')
-rw-r--r--src/include/pgstat.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index 053dd4de0d..9f4e0cac9b 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -45,7 +45,8 @@ typedef enum StatMsgType
PGSTAT_MTYPE_ANALYZE,
PGSTAT_MTYPE_BGWRITER,
PGSTAT_MTYPE_FUNCSTAT,
- PGSTAT_MTYPE_FUNCPURGE
+ PGSTAT_MTYPE_FUNCPURGE,
+ PGSTAT_MTYPE_RECOVERYCONFLICT
} StatMsgType;
/* ----------
@@ -364,6 +365,17 @@ typedef struct PgStat_MsgBgWriter
PgStat_Counter m_buf_alloc;
} PgStat_MsgBgWriter;
+/* ----------
+ * PgStat_MsgRecoveryConflict Sent by the backend upon recovery conflict
+ * ----------
+ */
+typedef struct PgStat_MsgRecoveryConflict
+{
+ PgStat_MsgHdr m_hdr;
+
+ Oid m_databaseid;
+ int m_reason;
+} PgStat_MsgRecoveryConflict;
/* ----------
* PgStat_FunctionCounts The actual per-function counts kept by a backend
@@ -460,6 +472,7 @@ typedef union PgStat_Msg
PgStat_MsgBgWriter msg_bgwriter;
PgStat_MsgFuncstat msg_funcstat;
PgStat_MsgFuncpurge msg_funcpurge;
+ PgStat_MsgRecoveryConflict msg_recoveryconflict;
} PgStat_Msg;
@@ -490,6 +503,12 @@ typedef struct PgStat_StatDBEntry
PgStat_Counter n_tuples_updated;
PgStat_Counter n_tuples_deleted;
TimestampTz last_autovac_time;
+ PgStat_Counter n_conflict_tablespace;
+ PgStat_Counter n_conflict_lock;
+ PgStat_Counter n_conflict_snapshot;
+ PgStat_Counter n_conflict_bufferpin;
+ PgStat_Counter n_conflict_startup_deadlock;
+
/*
* tables and functions must be last in the struct, because we don't write
@@ -689,6 +708,8 @@ extern void pgstat_report_vacuum(Oid tableoid, bool shared, bool adopt_counts,
extern void pgstat_report_analyze(Relation rel, bool adopt_counts,
PgStat_Counter livetuples, PgStat_Counter deadtuples);
+extern void pgstat_report_recovery_conflict(int reason);
+
extern void pgstat_initialize(void);
extern void pgstat_bestart(void);