Hi Tomas,

Thanks for the test script, I repro the same thing as you posted, and the
request size seems to just follow the fadvise range.

> I don't have a great solution to this. We'd need to do I/O combining,
> similarly to what happens on the primary. I'm not sure if it's feasible,
> or if it'd be better to rework the prefetcher to use read_stream (which
> has all of this built in).

Merging adjacent blocks into one smgrprefetch() call in the prefetcher
would be a small fix. But it is still only advice, so it does not help
io_direct. It also cannot merge across other relations.

I would rather move to AIO, then we do not need to change
this code in the future. But there are few interesting issues in my mind

1. WAL mixes many relations, so need to have multiple read streams
2. Redo may need to takes a cleanup lock... and prefetcher could also
pinned it, so we may need to change CheckBufferIsPinnedOnce()?

Maybe the right way is to implement a new API for redo or just use
Start/WaitReadBuffers()? WDYT?

Thanks,
Shihao

Reply via email to