On Wed, Jul 23, 2025 at 05:09:54PM +0900, Michael Paquier wrote: > On Jul 23, 2025, at 16:33, Bertrand Drouvot <bertranddrouvot...@gmail.com> > wrote: > > Maybe we could use a flag, say: > > > > #define PGSTAT_PENDING_IO (1 << 0) > > #define PGSTAT_PENDING_WAL (1 << 1) > > #define PGSTAT_PENDING_SLRU (1 << 2) > > > > and check for a pgstat_pending_mask in pgstat_report_stat() instead? > > > > They would need to set pgstat_pending_mask accordingly when they flush, have > > pending stats though. > > The point is just to say to the report path to move further if at least one of > the fixed stats kinds has something to flush, then let the loop do its work > across all the stats kinds if they have a flush callback,
Right. > so we don’t really need to mix multiple numbers; we could just have a single > boolean flag that any fixed-sized stats kinds can set to let the reporting > know > that some activity has happened. That works to say "there are pending stats" but not well to say "there are no pending stats". 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)? Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com