diff options
author | Magnus Hagander <magnus@hagander.net> | 2011-01-03 12:46:03 +0100 |
---|---|---|
committer | Magnus Hagander <magnus@hagander.net> | 2011-01-03 12:46:03 +0100 |
commit | 40d9e94bd7537144d3d379c1fd1264dff5cf4bb2 (patch) | |
tree | d7619d7a8393994adea064d6d67762b0f9f37037 /src/backend/tcop/postgres.c | |
parent | 1996b482859c67726e77b80a263d3cce954e022d (diff) | |
download | postgresql-40d9e94bd7537144d3d379c1fd1264dff5cf4bb2.tar.gz postgresql-40d9e94bd7537144d3d379c1fd1264dff5cf4bb2.zip |
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.
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r-- | src/backend/tcop/postgres.c | 7 |
1 files changed, 7 insertions, 0 deletions
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), |