1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

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.
This commit is contained in:
Magnus Hagander
2011-01-03 12:46:03 +01:00
parent 1996b48285
commit 40d9e94bd7
9 changed files with 287 additions and 5 deletions

View File

@ -2903,15 +2903,21 @@ ProcessInterrupts(void)
(errcode(ERRCODE_ADMIN_SHUTDOWN),
errmsg("terminating autovacuum process due to administrator command")));
else if (RecoveryConflictPending && RecoveryConflictRetryable)
{
pgstat_report_recovery_conflict(RecoveryConflictReason);
ereport(FATAL,
(errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
errmsg("terminating connection due to conflict with recovery"),
errdetail_recovery_conflict()));
}
else if (RecoveryConflictPending)
{
pgstat_report_recovery_conflict(RecoveryConflictReason);
ereport(FATAL,
(errcode(ERRCODE_ADMIN_SHUTDOWN),
errmsg("terminating connection due to conflict with recovery"),
errdetail_recovery_conflict()));
}
else
ereport(FATAL,
(errcode(ERRCODE_ADMIN_SHUTDOWN),
@ -2956,6 +2962,7 @@ ProcessInterrupts(void)
RecoveryConflictPending = false;
DisableNotifyInterrupt();
DisableCatchupInterrupt();
pgstat_report_recovery_conflict(RecoveryConflictReason);
if (DoingCommandRead)
ereport(FATAL,
(errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),