On Tue, May 20, 2025 at 3:22 PM Melanie Plageman <melanieplage...@gmail.com> wrote: > > > On Tue, May 20, 2025 at 5:23 PM Masahiko Sawada <sawada.m...@gmail.com> wrote: >> >> >> On Fri, May 2, 2025 at 11:59 AM Masahiko Sawada <sawada.m...@gmail.com> >> wrote: >> > >> > However, there is a possibility that we have already eagerly scanned >> > another page and returned it to the read stream before we freeze the >> > eagerly-scanned page and disable the eager scan. In this case, the >> > next block that we retrieved from the read stream could also be an >> > eagerly-scanned page. >> >> I've added it to Open Items for v18. >> >> If I understand correctly, there's a potential scenario where we might >> eagerly scan more pages than permitted by the success and failure >> caps. One question is: what is the practical magnitude of this excess >> scanning? If the overflow could be substantial (for instance, eagerly >> scanning 30% of table pages), we should consider revising our eager >> scanning mechanism. > > > Thanks for reporting this. Sorry I missed it initially. > > I need to do some more investigation, but IIUC you are saying that this is an > interaction between the read stream and eager scan code?
Yes. > I tried to confirm that was the case by setting io_combine_limit and > maintenance_io_concurrency to 1, which should be similar behavior to not > using the read stream WRT read combining etc. But, even doing so, your repro > tripped the assert. What made you suspect an interaction with the read stream? While I haven't identified how exactly read stream is related to this issue, what I've observed through debugging this issue is, during a single read_stream_next_buffer() call, I observed that heap_vac_scan_next_block() is invoked multiple times to return blocks to the read stream and that we continued processing eagerly scanned pages even after the success counter reaches zero while processing the previous block. Even when I set both io_combine_limit and maintenance_io_concurrency to 1, the debug logs showed that vacuum still performs eager scanning two blocks ahead of the current block being processed. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com