New wal_sync_method for Darwin?

From: Chris Campbell <chris(at)bignerdranch(dot)com>
To: pg_hackers(at)postgresql(dot)org
Subject: New wal_sync_method for Darwin?
Date: 2005-04-14 20:28:50
Message-ID: 7988ba02eb01d8532576baa979a52be4@bignerdranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-04-14 20:54:00 Re: [HACKERS] NetBSD mac68k crashing on union regression test
Previous Message Rémi Zara 2005-04-14 20:14:07 Re: [HACKERS] NetBSD mac68k crashing on union regression test