On Wed, Jul 23, 2025 at 11:59:11AM -0400, Andres Freund wrote: > On 2025-07-23 10:23:53 +0000, Bertrand Drouvot wrote: >> Indeed, with a single boolean flag, then how could a stat say that it has >> nothing >> pending anymore (when flushing) without saying "all the stats have nothing >> pending" (while some may still have pending stats)? > > I don't think that's a problem - reset that global flag after checking it at > the start of pgstat_report_stat() and set it to true if partial_flush is true > at the end of pgstat_report_stat().
That's one way of doing it. While looking at the code, I tend to think that it is actually simpler to reset it once at the bottom of pgstat_report_fixed, not touching it at all if we are in a partial_flush state because we know that we will need to do one report later on anyway, be it just for the stats in the dshash. If we do that, we can also skip entirely the flush_static_cb calls if pgstat_report_fixed is not set while doing the reports. -- Michael
signature.asc
Description: PGP signature