New wal_sync_method for Darwin?

Поиск
Список
Период
Сортировка
От Chris Campbell
Тема New wal_sync_method for Darwin?
Дата
Msg-id 7988ba02eb01d8532576baa979a52be4@bignerdranch.com
обсуждение исходный текст
Ответ на Re: Fwd: Apple Darwin disabled fsync?  ("Jim C. Nasby" <decibel@decibel.org>)
Список pgsql-hackers
I think we should add a new wal_sync_method that will use Darwin's 
F_FULLFSYNC fcntl().
From <sys/fnctl.h>:

#define F_FULLFSYNC     51              /* fsync + ask the drive to 
flush to the media */

This fcntl() will basically perform an fsync() on the file, then flush 
the write cache of the disk.

I'll attempt to work up the patch. It should be trivial. Might need 
some help on the configure tests though (it should #include 
<sys/fcntl.h> and make sure F_FULLFSYNC is defined).

What's an appropriate name? It seems equivalent to 
"fsync_writethrough". I suggest "fsync_full", "fsync_flushdisk", or 
something. Is there a reason we're not indicating the supported 
platform in the name of the method? Would "fsync_darwinfull" be better? 
Let users know that it's only available for Darwin? Should we do the 
same thing with win32-specific methods?

I think both fsync() and F_FULLFSYNC should both be available as 
options on Darwin. Currently in the code, "fsync" and 
"fsync_writethrough" set sync_method to SYNC_METHOD_FSYNC, so there's 
no way to distinguish between them.

Unsure which one would be the best default. fsync() matches the 
semantics on other platforms. And conscientious users could specify the 
F_FULLFSYNC fcntl() method if they want to make sure it goes through 
the write cache.

Comments?

Thanks!

- Chris

В списке pgsql-hackers по дате отправления:

Предыдущее
От: falcon
Дата:
Сообщение: Why not cache stable functions?
Следующее
От: "Magnus Hagander"
Дата:
Сообщение: Kerberos patch in the queue