From 40d9e94bd7537144d3d379c1fd1264dff5cf4bb2 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Mon, 3 Jan 2011 12:46:03 +0100 Subject: 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. --- src/backend/tcop/postgres.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/backend/tcop/postgres.c') diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 4bfc674f8fa..b227e6ce4f8 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -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), -- cgit v1.2.3