Andrey asked me to look into the thread. I'm not an expert in AIO.

But I managed(using AI) to build a stable reproducer. I hope this helps a bit.

> On 17 Jul 2026, at 02:19, Andrey Rachitskiy <[email protected]> wrote:
> 
> Between the two options you suggested for 19 — pass cnt = 1 for foreign IO in 
> WaitReadBuffers(), or skip wait-time accounting on that path as in the patch 
> I sent — I prefer the latter.
> Passing cnt = 1 would preserve the wait time, but it would also inflate reads 
> for backends that only join an in-progress IO and never start that read.

+0.1 from me to skipping accounting. Passing cnt=1 would double-count the block
in the waiting backend, which already tracks it as a hit and as read by the
initiating backend.

PFA test and Andrey Rachitskiy's fix. Test is not intended for a commit, there
are more variables in this equation than I'm aware of.


Best regards, Andrey Borodin.

Attachment: 0001-Add-test-for-pg_stat_io-accounting-of-foreign-IO-wai.patch
Description: Binary data

Attachment: 0002-Don-t-count-foreign-IO-wait-time-as-read-time-in-pg_.patch
Description: Binary data


Reply via email to