Re: Fsync (flush) all inserted WAL records

Aleksander Alekseev <aleksander@timescale.com>

From: Aleksander Alekseev <aleksander@timescale.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Vitaly Davydov <v.davydov@postgrespro.ru>
Date: 2024-08-07T15:00:45Z
Lists: pgsql-hackers
Hi,

> I use asynchronous commit (without XLogFlush/fsync at commit). At some moment I would like to XLogFlush (fsync) all already asynchronously committed transactions (inserted but not flushed/fsynced yet WAL records). Assume, that there is no any active transactions at this moment, no any potential race conditions. My problem is to find a proper LSN which I can use as a parameter for XLogFlush.

How is it different from `CHECKPOINT;` ?

> Well, I would like to use such function in C language code, in some solution, not as a function to be used by users.

Assuming the function has value, as you claim, I see no reason not to
expose it similarly to pg_current_wal_*(). On top of that you will
have to test-cover it anyway. The easiest way to do it will be to have
an SQL-wrapper.

-- 
Best regards,
Aleksander Alekseev