summaryrefslogtreecommitdiff
path: root/src/include/pgstat.h
diff options
context:
space:
mode:
authorMagnus Hagander2019-03-09 18:45:17 +0000
committerMagnus Hagander2019-03-09 18:47:30 +0000
commit6b9e875f7286d8535bff7955e5aa3602e188e436 (patch)
treebedeb8b9ba38b7aa151c329830589dc14bed292c /src/include/pgstat.h
parent3c5926301aea476025f118159688a6a88b2738bc (diff)
Track block level checksum failures in pg_stat_database
This adds a column that counts how many checksum failures have occurred on files belonging to a specific database. Both checksum failures during normal backend processing and those created when a base backup detects a checksum failure are counted. Author: Magnus Hagander Reviewed by: Julien Rouhaud
Diffstat (limited to 'src/include/pgstat.h')
-rw-r--r--src/include/pgstat.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index 88a75fb798e..725c8b0d64a 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -64,7 +64,8 @@ typedef enum StatMsgType
PGSTAT_MTYPE_FUNCPURGE,
PGSTAT_MTYPE_RECOVERYCONFLICT,
PGSTAT_MTYPE_TEMPFILE,
- PGSTAT_MTYPE_DEADLOCK
+ PGSTAT_MTYPE_DEADLOCK,
+ PGSTAT_MTYPE_CHECKSUMFAILURE
} StatMsgType;
/* ----------
@@ -530,6 +531,18 @@ typedef struct PgStat_MsgDeadlock
Oid m_databaseid;
} PgStat_MsgDeadlock;
+/* ----------
+ * PgStat_MsgChecksumFailure Sent by the backend to tell the collector
+ * about checksum failures noticed.
+ * ----------
+ */
+typedef struct PgStat_MsgChecksumFailure
+{
+ PgStat_MsgHdr m_hdr;
+ Oid m_databaseid;
+ int m_failurecount;
+} PgStat_MsgChecksumFailure;
+
/* ----------
* PgStat_Msg Union over all possible messages.
@@ -593,6 +606,7 @@ typedef struct PgStat_StatDBEntry
PgStat_Counter n_temp_files;
PgStat_Counter n_temp_bytes;
PgStat_Counter n_deadlocks;
+ PgStat_Counter n_checksum_failures;
PgStat_Counter n_block_read_time; /* times in microseconds */
PgStat_Counter n_block_write_time;
@@ -1200,6 +1214,8 @@ extern void pgstat_report_analyze(Relation rel,
extern void pgstat_report_recovery_conflict(int reason);
extern void pgstat_report_deadlock(void);
+extern void pgstat_report_checksum_failures_in_db(Oid dboid, int failurecount);
+extern void pgstat_report_checksum_failure(void);
extern void pgstat_initialize(void);
extern void pgstat_bestart(void);