Re: Fsync (flush) all inserted WAL records
Vitaly Davydov <v.davydov@postgrespro.ru>
From: "Vitaly Davydov" <v.davydov@postgrespro.ru>
To: "Michael Paquier" <michael@paquier.xyz>
Cc: "Aleksander Alekseev" <aleksander@timescale.com>,
"PostgreSQL-development" <pgsql-hackers@postgresql.org>
Date: 2024-08-20T15:18:45Z
Lists: pgsql-hackers
Attachments
- 0001-Add-function-to-return-the-end-LSN-of-the-last-inser.patch (text/x-patch) patch 0001
Dear All, I would propose a new function like GetXLogInsertRecPtr(), but with some modifications (please, see the attached patch). The result LSN can be passed to XLogFLush() safely. I believe, it will not raise an error in any case. XLogFlush(GetXLogLastInsertEndRecPtr()) will flush (fsync) all already inserted records at the moment. It is what I would like to get. I'm not sure, we need a SQL function counterpart for this new C function, but it is not a big deal to implement. With best regards, Vitaly On Monday, August 19, 2024 09:35 MSK, Michael Paquier <michael@paquier.xyz> wrote: On Wed, Aug 07, 2024 at 06:00:45PM +0300, Aleksander Alekseev wrote: > 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. I cannot be absolutely without seeing a patch, but adding SQL functions in this area is usually very useful for monitoring purposes of external solutions. -- Michael