Re: AIO v2.0 - Mailing list pgsql-hackers

From Andres Freund
Subject Re: AIO v2.0
Date
Msg-id 4gqgbziuexn57o47t5ovvwok4n4tiuznhrxi44cau6kv6zsfga@vuyxkxznp3uk
Whole thread Raw
In response to Re: AIO v2.0  (陈宗志 <baotiao@gmail.com>)
List pgsql-hackers
Hi,

On 2024-09-05 01:37:34 +0800, 陈宗志 wrote:
> I hope there can be a high-level design document that includes a
> description, high-level architecture, and low-level design.
> This way, others can also participate in reviewing the code.

Yep, that was already on my todo list. The version I just posted includes
that.


> For example, which paths were modified in the AIO module?
> Is it the path for writing WAL logs, or the path for flushing pages, etc.?

I don't think it's good to document this in a design document - that's just
bound to get out of date.

For now the patchset causes AIO to be used for

1) all users of read_stream.h, e.g. sequential scans

2) bgwriter / checkpointer, mainly to have way to exercise the write path. As
   mentioned in my email upthread, the code for that is in a somewhat rough
   shape as Thomas Munro is working on a more general abstraction for some of
   this.

The earlier patchset added a lot more AIO uses because I needed to know all
the design constraints. It e.g. added AIO use in WAL. While that allowed me to
learn a lot, it's not something that makes sense to continue working on for
now, as it requires a lot of work that's independent of AIO.  Thus I am
focusing on the above users for now.


> Also, I recommend keeping this patch as small as possible.

Yep. That's my goal (as mentioned upthread).


> For example, the first step could be to introduce libaio only, without
> considering io_uring, as that would make it too complex.

Currently the patchset doesn't contain libaio support and I am not planning to
work on using libaio. Nor do I think it makes sense for anybody else to do so
- libaio doesn't work for buffered IO, making it imo not particularly useful
for us.

The io_uring specific code isn't particularly complex / large compared to the
main AIO infrastructure.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Remove hardcoded hash opclass function signature exceptions
Next
From: Masahiko Sawada
Date:
Subject: Re: pg_trgm comparison bug on cross-architecture replication due to different char implementation