Re: We really ought to do something about O_DIRECT and data=journalled on ext4
Marti Raudsepp <marti@juffo.org>
From: Marti Raudsepp <marti@juffo.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Greg Smith <greg@2ndquadrant.com>, Josh Berkus <josh@agliodbs.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2010-12-08T15:14:18Z
Lists: pgsql-hackers
On Tue, Dec 7, 2010 at 03:34, Tom Lane <tgl@sss.pgh.pa.us> wrote: > To my mind, O_DIRECT is not really the key issue here, it's whether to > prefer O_DSYNC or fdatasync. Since different platforms implement these primitives differently, and it's not always clear from the header file definitions which options are actually implemented, how about simply hard-coding a default value for each platform? 1. This would be quite straightforward to code and document (a table of platforms and their default wal_sync_method setting) 2. The best performing (or safest) method can be chosen on every platform. From the above discussion it seems that Windows and OSX should default to fdatasync_writethrough even if other methods are available 3. It would pre-empt similar surprises if other platforms change their header files, like what happened on Linux now. Sounds like the simple and foolproof solution. Regards, Marti