From: | Melanie Plageman <melanieplageman(at)gmail(dot)com> |
---|---|
To: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Cc: | Andres Freund <andres(at)anarazel(dot)de> |
Subject: | Issue with pg_stat_subscription_stats |
Date: | 2022-03-11 20:44:15 |
Message-ID: | CAAKRu_Zqd-e5imT_3-ZiQv1cfsWuy16OJTiUaCvqpq4V7GVdSg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2022-03-11 21:10:36 | Re: On login trigger: take three |
Previous Message | Heikki Linnakangas | 2022-03-11 20:42:42 | Re: Non-replayable WAL records through overflows and >MaxAllocSize lengths |