mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
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
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user