On Tue, Feb 22, 2022 at 11:15 AM Masahiko Sawada <sawada.m...@gmail.com> wrote: > > I've attached a patch that changes pg_stat_subscription_workers view. > It removes non-cumulative values such as error details such as > error-XID and the error message from the view, and consequently the > view now has only cumulative statistics counters: apply_error_count > and sync_error_count. Since the new view name is under discussion I > temporarily chose pg_stat_subscription_activity. >
Few comments: ============= 1. --- a/src/backend/catalog/system_functions.sql +++ b/src/backend/catalog/system_functions.sql @@ -637,11 +637,9 @@ REVOKE EXECUTE ON FUNCTION pg_stat_reset_single_table_counters(oid) FROM public; REVOKE EXECUTE ON FUNCTION pg_stat_reset_single_function_counters(oid) FROM public; -REVOKE EXECUTE ON FUNCTION pg_stat_reset_replication_slot(text) FROM public; - -REVOKE EXECUTE ON FUNCTION pg_stat_reset_subscription_worker(oid) FROM public; +REVOKE EXECUTE ON FUNCTION pg_stat_reset_single_subscription_counters(oid) FROM public; -REVOKE EXECUTE ON FUNCTION pg_stat_reset_subscription_worker(oid, oid) FROM public; +REVOKE EXECUTE ON FUNCTION pg_stat_reset_replication_slot(text) FROM public; Is there a need to change anything about pg_stat_reset_replication_slot() in this patch? 2. Do we still need to use LATERAL in the view's query? 3. Can we send error stats pgstat_report_stat() as that will be called via proc_exit() path. We can set the phase (apply/sync) in apply_error_callback_arg and then use that to send the appropriate message. I think this will obviate the need for try..catch. -- With Regards, Amit Kapila.