Re: fd.c: flush data problems on osx

Поиск
Список
Период
Сортировка
Искать
От
Stas Kelvich
Тема
Re: fd.c: flush data problems on osx
Дата
Msg-id
827E11CD-4D55-4E04-ABEC-971315C15F4E@postgrespro.ru
Ответ на
Список
Дерево обсуждения
fd.c: flush data problems on osx Stas Kelvich <s.kelvich@postgrespro.ru>
Re: fd.c: flush data problems on osx Andres Freund <andres@anarazel.de>
Re: fd.c: flush data problems on osx Stas Kelvich <s.kelvich@postgrespro.ru>
Re: fd.c: flush data problems on osx Stas Kelvich <s.kelvich@postgrespro.ru>
Re: fd.c: flush data problems on osx Andres Freund <andres@anarazel.de>
Re: fd.c: flush data problems on osx Stas Kelvich <s.kelvich@postgrespro.ru>
Re: fd.c: flush data problems on osx Noah Misch <noah@leadboat.com>
Re: fd.c: flush data problems on osx Michael Paquier <michael.paquier@gmail.com>
Re: fd.c: flush data problems on osx Tom Lane <tgl@sss.pgh.pa.us>
Re: fd.c: flush data problems on osx Tom Lane <tgl@sss.pgh.pa.us>
Re: fd.c: flush data problems on osx Andres Freund <andres@anarazel.de>
Re: fd.c: flush data problems on osx Tom Lane <tgl@sss.pgh.pa.us>
Re: fd.c: flush data problems on osx Andres Freund <andres@anarazel.de>
Re: fd.c: flush data problems on osx Tom Lane <tgl@sss.pgh.pa.us>
Re: fd.c: flush data problems on osx Andres Freund <andres@anarazel.de>
Re: fd.c: flush data problems on osx Tom Lane <tgl@sss.pgh.pa.us>

> On 18 Mar 2016, at 14:45, Stas Kelvich  wrote:
>> 
>>> One possible solution for that is just fallback to pg_fdatasync in case when offset = nbytes = 0.
>> 
>> Hm, that's a bit heavyweight. I'd rather do an lseek(SEEK_END) to get
>> the file size. Could you test that?
>> 
> 
> It looks like OSX mmap raises EINVAL when length isn’t aligned to pagesize while manual says it can be of arbitrary length, so i aligned it.
> Also there were call to mmap with PROT_READ | PROT_WRITE, but when called from pre_sync_fname file descriptor is just O_RDONLY, so i changed mmap mode to PROT_READ — seems that PROT_WRITE wasn’t needed anyway.
> 
> And all of that reduces number of warnings in order of magnitude but there are still some and I don’t yet understand why are they happening.

I’ve spend some more time on this issue and found that remaining warnings were caused by mmap-ing directories — that raises EINVAL in OSX (probably not only OSX, but I didn’t tried).
So i’ve skipped mmap for dirs and now restore happens without warnings. Also I’ve fixed wrong error check that was in previous version of patch.




---
Stas Kelvich
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company

В списке pgsql-hackers по дате отправления
От: Alexander Korotkov
Дата:
От: Andres Freund
Дата:
FAQ