Re: Closing some 8.4 open items

From: Greg Smith <gsmith(at)gregsmith(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Closing some 8.4 open items
Date: 2009-04-08 18:35:51
Message-ID: alpine.GSO.2.01.0904081418500.13502@westnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 8 Apr 2009, Heikki Linnakangas wrote:

> Josh Berkus wrote:
>> The other thing I was going to ask you about is using posix_fadvise as an
>> alternative to O_DIRECT for the xlog. O_DIRECT is, AFAIK, linux-only,
>> whereas there are "direct write" fadvise flags which work on multiple OSes.
>
> What flags are those? I don't see any posix_fadvise flags that would do
> anything like O_DIRECT.

A good implementation of FADV_NOREUSE would work similarly to O_DIRECT,
writing things out but not keeping them around the OS cache. (suggested
long ago even:
http://archives.postgresql.org//pgsql-hackers/2003-10/msg01492.php )

I know there's a problem with O_DIRECT not working on Solaris; see the
following:

http://blogs.sun.com/jkshah/entry/postgresql_wal_sync_method_and
http://blogs.sun.com/roch/entry/zfs_and_directio
http://docs.sun.com/app/docs/doc/816-5168/directio-3c

I'm not sure whether using an fadvise call like FADV_NOREUSE will work any
better though; it may be the case that only that directio call is
sufficient on Solaris. A Solaris-specific code path that calls directio
is what MySQL does here:
http://dev.mysql.com/doc/refman/5.1/en/innodb-parameters.html#sysvar_innodb_flush_method

I wanted to include such a patch in 8.4 but my one Solaris project got
sidelined.

Saying that O_DIRECT is "linux-only" doesn't seem right though. The same
thread referenced above started by announcing O_DIRECT support on FreeBSD:
http://archives.postgresql.org//pgsql-hackers/2003-10/msg01482.php and the
above MySQL documentation supports that it works on FreeBSD, too. I've
seen claims that it works fine on Mac OS X, too, although MySQL may not
support that:
http://labs.cybozu.co.jp/blog/kazuhoatwork/2009/02/using_o_direct_on_mac_os_x.php

--
* Greg Smith gsmith(at)gregsmith(dot)com http://www.gregsmith.com Baltimore, MD

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Smith 2009-04-08 18:53:29 Re: Closing some 8.4 open items
Previous Message Josh Berkus 2009-04-08 18:32:00 Re: Closing some 8.4 open items