mirror of
https://github.com/postgres/postgres.git
synced 2025-11-24 00:23:06 +03:00
Add seq_sync_error_count to subscription statistics.
This commit adds a new column, seq_sync_error_count, to the pg_stat_subscription_stats view. This counter tracks the number of errors encountered by the sequence synchronization worker during operation. Since a single worker handles the synchronization of all sequences, this value may reflect errors from multiple sequences. This addition improves observability of sequence synchronization behavior and helps monitor potential issues during replication. Author: Vignesh C <vignesh21@gmail.com> Reviewed-by: shveta malik <shveta.malik@gmail.com> Reviewed-by: Peter Smith <smithpb2250@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Discussion: https://postgr.es/m/CAA4eK1LC+KJiAkSrpE_NwvNdidw9F2os7GERUeSxSKv71gXysQ@mail.gmail.com
This commit is contained in:
@@ -732,6 +732,9 @@ start_sequence_sync()
|
||||
* idle state.
|
||||
*/
|
||||
AbortOutOfAnyTransaction();
|
||||
pgstat_report_subscription_error(MySubscription->oid,
|
||||
WORKERTYPE_SEQUENCESYNC);
|
||||
|
||||
PG_RE_THROW();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1530,7 +1530,8 @@ start_table_sync(XLogRecPtr *origin_startpos, char **slotname)
|
||||
* idle state.
|
||||
*/
|
||||
AbortOutOfAnyTransaction();
|
||||
pgstat_report_subscription_error(MySubscription->oid, false);
|
||||
pgstat_report_subscription_error(MySubscription->oid,
|
||||
WORKERTYPE_TABLESYNC);
|
||||
|
||||
PG_RE_THROW();
|
||||
}
|
||||
|
||||
@@ -5606,7 +5606,8 @@ start_apply(XLogRecPtr origin_startpos)
|
||||
* idle state.
|
||||
*/
|
||||
AbortOutOfAnyTransaction();
|
||||
pgstat_report_subscription_error(MySubscription->oid, !am_tablesync_worker());
|
||||
pgstat_report_subscription_error(MySubscription->oid,
|
||||
MyLogicalRepWorker->type);
|
||||
|
||||
PG_RE_THROW();
|
||||
}
|
||||
@@ -5953,15 +5954,12 @@ DisableSubscriptionAndExit(void)
|
||||
|
||||
RESUME_INTERRUPTS();
|
||||
|
||||
if (am_leader_apply_worker() || am_tablesync_worker())
|
||||
{
|
||||
/*
|
||||
* Report the worker failed during either table synchronization or
|
||||
* apply.
|
||||
*/
|
||||
pgstat_report_subscription_error(MyLogicalRepWorker->subid,
|
||||
!am_tablesync_worker());
|
||||
}
|
||||
/*
|
||||
* Report the worker failed during sequence synchronization, table
|
||||
* synchronization, or apply.
|
||||
*/
|
||||
pgstat_report_subscription_error(MyLogicalRepWorker->subid,
|
||||
MyLogicalRepWorker->type);
|
||||
|
||||
/* Disable the subscription */
|
||||
StartTransactionCommand();
|
||||
|
||||
Reference in New Issue
Block a user