Re: Fsync (flush) all inserted WAL records - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: Fsync (flush) all inserted WAL records
Date
Msg-id CAJ7c6TNe_UeXwv0BbTxOEyhQXLA-g4qAcVCpV=GSuTHVSXswfA@mail.gmail.com
Whole thread Raw
In response to Re: Fsync (flush) all inserted WAL records  ("Vitaly Davydov" <v.davydov@postgrespro.ru>)
Responses Re: Fsync (flush) all inserted WAL records
List 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
functionsunreasonably:
 
>
> 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



pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: Support specify tablespace for each merged/split partition
Next
From: Sami Imseih
Date:
Subject: Re: Restart pg_usleep when interrupted