On Tue, Nov 03, 2026 at 02:58:31PM -0800, Lukas Fittl wrote:
> I don't think (2) is workable, especially if we want a design that
> also works for pgBufferUsage - doing any extra work in InstrStopNode
> is too expensive (instruction-wise, and because of the size of the
> memory being accessed).

Hmm.  I have not looked at that.  But would it really matter if we
just drop pgWalUsage?  We only need the aggregated data from the
leaders and its workers when we are ready to report the data.

> I think (3) could potentially be an alternate, but I don't know if its
> worth the trouble just to avoid the WalUsageAccumDiff on flush, which
> is not in the hot path.

With only HEAD in mind, (2) just seems like the simplest alternative,
because there is less to consider about all these states except
summing them up, where necessary.  The origin of the double-counting
comes from the point of pgWalUsage being rather confusing in itself,
because we do not define when it is okay or when is is not okay to
use.  If it's confusing, I would not be sad to see it gone on HEAD,
replaced by a WalUsage that just tracks the activity within the
process, combined with a secondary WalUsage where we aggregate from
activity from the workers.
--
Michael

Attachment: signature.asc
Description: PGP signature

Reply via email to