On Wed, Jun 03, 2026 at 05:10:39PM +0900, Kyotaro Horiguchi wrote: > One alternative would be to introduce a separate callback for anytime > flushes. However, since transaction-boundary flushes ultimately need > to flush everything anyway, it seems to me that passing a context flag > would be sufficient.
Nah. I am not really in favor of an extra callback. I feel that this could lead to more mistakes when implementing new stats kinds, so doing your approach of using a value based on the context of the flush works for me. > I tend to agree with the single-entry-point approach. > > The basic operation is common; the anytime case differs only in the > context in which the flush is requested. The flush-timing logic in > pgstat_report_stat() may become slightly more complicated with anytime > flushes, but after that point I think the existing path should > continue to work with only minor adjustments, by carrying an explicit > context value down to the callbacks. Yeah, same feeling here. That would be the way I'd use to approach this design, and to aim for one single entry point for all the stats reports and the flushes, for all the contexts. -- Michael
signature.asc
Description: PGP signature
