Re: aio: Async fsyncs for crash recovery and checkpointer

From: Yuhang Qiu <iamqyh(at)gmail(dot)com>
To: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
Cc: Nitin Jadhav <nitinjadhavpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: aio: Async fsyncs for crash recovery and checkpointer
Date: 2026-09-03 13:15:15
Message-ID: D707392D-96FF-4867-943D-564DAD6644B3@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message cca5507 2026-09-03 13:17:18 Re: [PATCH] Allow bare library names for non-superuser LOAD
Previous Message Peter Eisentraut 2026-09-03 13:01:14 Re: new clang warnings about unused global variables