From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
Cc: | Alexander Lakhin <exclusion(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Xuneng Zhou <xunengzhou(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: per backend WAL statistics |
Date: | 2025-04-07 00:54:46 |
Message-ID: | Z_MiVq-HzPlMS7Q_@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Mar 31, 2025 at 07:42:19AM +0000, Bertrand Drouvot wrote:
> I think we can simply move the pgstat_fetch_stat_backend() call at the end
> of pgstat_fetch_stat_backend_by_pid(), like in the attached. With this in place
> the issue is fixed on my side.
>
> Thoughts?
Confirmed. I agree that it is simpler to move all the accesses to
beentry before attempting to retrieve the pgstats entry.
One thing that itched me a bit in the patch is that we would set
bktype even if we don't have a pgstats entry. The two callers of
pgstat_fetch_stat_backend_by_pid() return tuples full of NULLs and
zeros in this case, discarding the backend type automatically, but
let's keep the API consistent and set the value to B_INVALID if
pgstat_fetch_stat_backend() returns NULL.
I have added a comment warning about not accessing beentry when
fetching the backend pgstats entry, and applied the result. Thanks
for the report, Alexander, and for the patch, Bertrand.
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Gustafsson | 2025-04-07 00:55:07 | Re: Possibly hard-to-read message |
Previous Message | Greg Sabino Mullane | 2025-04-07 00:49:50 | Re: Logging which local address was connected to in log_line_prefix |