pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Yuhang Qiu <iamqyh@gmail.com>
To: Nazir Bilal Yavuz <byavuz81@gmail.com>
Cc: Nitin Jadhav <nitinjadhavpostgres@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Andres Freund <andres@anarazel.de>
Subject: Re: aio: Async fsyncs for crash recovery and checkpointer
Date: Thu, 3 Sep 2026 21:15:15 +0800
Message-ID: <D707392D-96FF-4867-943D-564DAD6644B3@gmail.com> (raw)
In-Reply-To: <CAN55FZ1wTRvSCnzVH240zb8jEvjSgkc-cOGqMFehGrsQOyK1tA@mail.gmail.com>
References: <CAN55FZ0vLWJQNB=HuHXG2wabFjXJd6OWTa3=kRzwObdZD9poHQ@mail.gmail.com>
	<CAMm1aWZQy3U8TDTDP5rOhRE5EmYLtVzCFLqBu7s+roE0bi6TxQ@mail.gmail.com>
	<CAN55FZ1wTRvSCnzVH240zb8jEvjSgkc-cOGqMFehGrsQOyK1tA@mail.gmail.com>

Hi Nazir,

The overall direction looks good to me. A few points:

> This patch implements async fsyncs for crash recovery and checkpoints by
> using the AIO system.

For crash recovery, Linux already has `recovery_init_sync_method=syncfs` as an
alternative to per-file fsyncs. I think it would be useful to include that in
the `SyncDataDirectory()` benchmark.

> I will change the reopen interface so that ordinary failures return
> `-errno`.

Agreed. I think all AIO target reopen callbacks should follow this convention.
Relation fsyncs can hit the same problem through `smgr_aio_reopen()`, not only
SLRUs.

> It uses both io_max_concurrency and the file descriptor budget to determine
> max number of available in-flight fsync I/Os.

I wonder whether submitting a batch of concurrent fsyncs could cause an I/O
storm and hurt foreground I/O latency.

The `max_safe_fds / 6` cap protects the `AllocateDesc` budget used by
`OpenTransientFile()`, while relation fsyncs use VFDs. Should the descriptor
cap apply only to handlers that use `OpenTransientFile()`?

Best regards,
Yuhang Qiu







view thread (9+ messages)  latest in thread

Message-ID: <D707392D-96FF-4867-943D-564DAD6644B3@gmail.com>
Permalink:  ../D707392D-96FF-4867-943D-564DAD6644B3@gmail.com/
Also on:    postgresql.org/message-id/D707392D-96FF-4867-943D-564DAD6644B3@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: iamqyh@gmail.com, byavuz81@gmail.com, nitinjadhavpostgres@gmail.com, andres@anarazel.de
  Subject: Re: aio: Async fsyncs for crash recovery and checkpointer
  In-Reply-To: <D707392D-96FF-4867-943D-564DAD6644B3@gmail.com>
  References: <CAN55FZ0vLWJQNB=HuHXG2wabFjXJd6OWTa3=kRzwObdZD9poHQ@mail.gmail.com> <CAMm1aWZQy3U8TDTDP5rOhRE5EmYLtVzCFLqBu7s+roE0bi6TxQ@mail.gmail.com> <CAN55FZ1wTRvSCnzVH240zb8jEvjSgkc-cOGqMFehGrsQOyK1tA@mail.gmail.com> <D707392D-96FF-4867-943D-564DAD6644B3@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox