Issue with pg_stat_subscription_stats - Mailing list pgsql-hackers

From Melanie Plageman
Subject Issue with pg_stat_subscription_stats
Date
Msg-id CAAKRu_Zqd-e5imT_3-ZiQv1cfsWuy16OJTiUaCvqpq4V7GVdSg@mail.gmail.com
Whole thread Raw
Responses Re: Issue with pg_stat_subscription_stats  (Amit Kapila <amit.kapila16@gmail.com>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Non-replayable WAL records through overflows and >MaxAllocSize lengths
Next
From: Robert Haas
Date:
Subject: Re: On login trigger: take three