mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +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:
@ -1497,6 +1497,21 @@ pg_stat_get_db_deadlocks(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_INT64(result);
|
||||
}
|
||||
|
||||
Datum
|
||||
pg_stat_get_db_checksum_failures(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Oid dbid = PG_GETARG_OID(0);
|
||||
int64 result;
|
||||
PgStat_StatDBEntry *dbentry;
|
||||
|
||||
if ((dbentry = pgstat_fetch_stat_dbentry(dbid)) == NULL)
|
||||
result = 0;
|
||||
else
|
||||
result = (int64) (dbentry->n_checksum_failures);
|
||||
|
||||
PG_RETURN_INT64(result);
|
||||
}
|
||||
|
||||
Datum
|
||||
pg_stat_get_db_blk_read_time(PG_FUNCTION_ARGS)
|
||||
{
|
||||
|
Reference in New Issue
Block a user