Re: per backend WAL statistics - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: per backend WAL statistics
Date
Msg-id Z8ukEg7Z3KsNfEoo@paquier.xyz
Whole thread Raw
In response to Re: per backend WAL statistics  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
List pgsql-hackers
On Fri, Mar 07, 2025 at 08:33:04AM +0000, Bertrand Drouvot wrote:
> But when it's time to flush, then pgstat_backend_have_pending_cb() checks
> for zeros in PendingBackendStats *without* any check on the backend type.
>
> I think the issue is "masked" on HEAD because PendingBackendStats is
> probably automatically initialized with zeros (as being a static variable at
> file scope).

If this weren't true, we would have a lot of problems in more places
than this one.  It does not hurt to add an initialization at the top
of pgstat_backend.c for PendingBackendStats, to document the
intention, while we're on it.

Did both things, and applied the result.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Nikhil Kumar Veldanda
Date:
Subject: Re: ZStandard (with dictionaries) compression support for TOAST compression
Next
From: Andres Freund
Date:
Subject: Re: AIO v2.5