Create subscription stats entry at CREATE SUBSCRIPTION time

Previously, the subscription stats entry was created when the first
stats, i.e., an error on apply worker or tablesync worker,  were
reported. Therefore, the stats_reset field was not updated by
pg_stat_reset_subscription_stats() if the stats entry was not
populated yet, which was different behavior than other statistics.

This change creates the subscription stats entry and initializes it at
CREATE SUBSCRIPTION time.

Reviewed-by: Andres Freund <[email protected]>
Reviewed-by: Amit Kapila <[email protected]>
Author: Masahiko Sawada <[email protected]>
Discussion: 
https://postgr.es/m/caakru_zqd-e5imt_3-ziqv1cfswuy16ojtiuacvqpq4v7gv...@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e0b0142959066f3a9de1c6867f4ec8d41d104f33

Modified Files
--------------
src/backend/utils/activity/pgstat_subscription.c |  8 ++++--
src/test/regress/expected/subscription.out       | 34 ++++++++++++++++++++++++
src/test/regress/sql/subscription.sql            | 11 ++++++++
3 files changed, 51 insertions(+), 2 deletions(-)

Reply via email to