- Notifications
You must be signed in to change notification settings - Fork5k
Commit12ce89f
bufmgr: Use AIO in StartReadBuffers()
This finally introduces the first actual use of AIO. StartReadBuffers() nowuses the AIO routines to issue IO.As the implementation of StartReadBuffers() is also used by the functions forreading individual blocks (StartReadBuffer() and through thatReadBufferExtended()) this means all buffered read IO passes through the AIOpaths. However, as those are synchronous reads, actually performing the IOasynchronously would be rarely beneficial. Instead such IOs are flagged toalways be executed synchronously. This way we don't have to duplicate a fairbit of code.When io_method=sync is used, the IO patterns generated after this change arethe same as before, i.e. actual reads are only issued in WaitReadBuffers() andStartReadBuffers() may issue prefetch requests. This allows to bypass most ofthe actual asynchronicity, which is important to make a change as big as thisless risky.One thing worth calling out is that, if IO is actually executedasynchronously, the precise meaning of what track_io_timing is measuring haschanged. Previously it tracked the time for each IO, but that does not makesense when multiple IOs are executed concurrently. Now it only measures thetime actually spent waiting for IO. A subsequent commit will adjust the docsfor this.While AIO is now actually used, the logic in read_stream.c will often preventusing sufficiently many concurrent IOs. That will be addressed in the nextcommit.Reviewed-by: Noah Misch <noah@leadboat.com>Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>Co-authored-by: Andres Freund <andres@anarazel.de>Co-authored-by: Thomas Munro <thomas.munro@gmail.com>Discussion:https://postgr.es/m/uvrtrknj4kdytuboidbhwclo4gxhswwcpgadptsjvjqcluzmah%40brqs62irg4dtDiscussion:https://postgr.es/m/20210223100344.llw5an2aklengrmn@alap3.anarazel.deDiscussion:https://postgr.es/m/stj36ea6yyhoxtqkhpieia2z4krnam7qyetc57rfezgk4zgapf@gcnactj4z56m1 parent047cba7 commit12ce89f