Re: Fsync (flush) all inserted WAL records

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Vitaly Davydov <v(dot)davydov(at)postgrespro(dot)ru>
Subject: Re: Fsync (flush) all inserted WAL records
Date: 2024-08-07 13:55:36
Message-ID: CAJ7c6TNe_UeXwv0BbTxOEyhQXLA-g4qAcVCpV=GSuTHVSXswfA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Vitaly,

> I would propose a new function to fulfill my requirements like this (see below) but I prefer not to create new functions unreasonably:
>
> XLogRecPtr
> GetXLogLastInsertEndRecPtr(void)
> {
> XLogCtlInsert *Insert = &XLogCtl->Insert;
> uint64 current_bytepos;
> SpinLockAcquire(&Insert->insertpos_lck);
> current_bytepos = Insert->CurrBytePos;
> SpinLockRelease(&Insert->insertpos_lck);
> return XLogBytePosToEndRecPtr(current_bytepos);
> }
>
> This function differs from the existing GetXLogInsertRecPtr() by calling XLogBytePosToEndRecPtr instead of XLogBytePosToRecPtr.

Perhaps you could give more context on the use cases for this
function? The value of it is not quite clear. What people typically
need is making sure if a given LSN was fsync'ed and/or replicated
and/or applied on a replica. Your case(s) however is different and I
don't fully understand it.

In any case you will need to implement an SQL-wrapper in order to make
the function available to DBAs, cover it with tests and provide
documentation.

--
Best regards,
Aleksander Alekseev

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2024-08-07 14:11:19 Re: Restart pg_usleep when interrupted
Previous Message Fujii Masao 2024-08-07 13:54:40 Re: Support specify tablespace for each merged/split partition