Re: Fsync (flush) all inserted WAL records

From: "Vitaly Davydov" <v(dot)davydov(at)postgrespro(dot)ru>
To: "Michael Paquier" <michael(at)paquier(dot)xyz>
Cc: "Aleksander Alekseev" <aleksander(at)timescale(dot)com>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fsync (flush) all inserted WAL records
Date: 2024-08-20 15:18:45
Message-ID: fe3d0-66c4b400-17-513a8800@121447422
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


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(at)paquier(dot)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

 

Attachment Content-Type Size
0001-Add-function-to-return-the-end-LSN-of-the-last-inser.patch text/x-patch 1.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2024-08-20 15:24:11 Re: Add new protocol message to change GUCs for usage with future protocol-only GUCs
Previous Message Tom Lane 2024-08-20 15:04:07 Re: Test 041_checkpoint_at_promote.pl faild in installcheck due to missing injection_points