Re: Fsync (flush) all inserted WAL records
От | Aleksander Alekseev |
---|---|
Тема | Re: Fsync (flush) all inserted WAL records |
Дата | |
Msg-id | CAJ7c6TPaYLHin2S_R60OFUr4Lsv2piyq+7KLakgY=SBKpZB3zw@mail.gmail.com обсуждение исходный текст |
Ответ на | Fsync (flush) all inserted WAL records ("Vitaly Davydov" <v.davydov@postgrespro.ru>) |
Ответы |
Re: Fsync (flush) all inserted WAL records
|
Список | pgsql-hackers |
Hi, > I use async commits. At some moment, I would like to make sure that all inserted WAL records are fsync-ed. I can use XLogFlushfunction but I have some doubts which LSN to specify. There is a number of functions which return write or insertLSNs but they are not applicable. > > I can't use GetXLogInsertRecPtr() because it returns a real insert LSN, not the end LSN of the last record. XLogFlush mayfail with such LSN because the specified LSN may be "in the future" if the WAL record ends up to the page boundary (thereal insert LSN is summed up with page header size). > > I can't use GetXLogWriteRecPtr() because it seems to be bounded to page boundaries. Some inserted WAL records may not befsync-ed. Some other functions seems not applicable as well. > > The first idea is to use GetLastImportantRecPtr() but this function returns the start LSN of the last important WAL record.I would use XLogFlush(GetLastImportantRecPtr() + 1) but I'm not sure that this way is conventional. > > Another idea is to create a new function like GetXLogInsertRecPtr() which calls XLogBytePosToEndRecPtr() instead of XLogBytePosToRecPtr()inside it. > > Could you please advice which way to go? Does pg_current_wal_flush_lsn() [1] return what you need? [1]: https://www.postgresql.org/docs/current/functions-admin.html#FUNCTIONS-RECOVERY-CONTROL -- Best regards, Aleksander Alekseev
В списке pgsql-hackers по дате отправления: