So, I noticed that pg_stat_reset_subscription_stats() wasn't working
properly, and, upon further investigation, I'm not sure the view
pg_stat_subscription_stats is being properly populated.

I don't think subscriptionStatHash will be created properly and that the
reset timestamp won't be initialized without the following code:

diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index 53ddd930e6..0b8c5436e9 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -3092,7 +3092,7 @@ pgstat_fetch_stat_subscription(Oid subid)
        /* Load the stats file if needed */
        backend_read_statsfile();

-       return pgstat_get_subscription_entry(subid, false);
+       return pgstat_get_subscription_entry(subid, true);
 }

 /*
@@ -6252,7 +6252,7 @@ pgstat_get_subscription_entry(Oid subid, bool create)

        /* If not found, initialize the new one */
        if (!found)
-               pgstat_reset_subscription(subentry, 0);
+               pgstat_reset_subscription(subentry, GetCurrentTimestamp());

        return subentry;
 }

- melanie


Reply via email to