Re: fix use of posix_fadvise in xlog.c - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: fix use of posix_fadvise in xlog.c
Date
Msg-id 4C1106CD.6030205@enterprisedb.com
Whole thread Raw
In response to Re: fix use of posix_fadvise in xlog.c  (Mark Wong <markwkm@gmail.com>)
Responses Re: fix use of posix_fadvise in xlog.c  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 10/06/10 18:17, Mark Wong wrote:
> On Jun 9, 2010, at 11:25 PM, Heikki Linnakangas
> <heikki.linnakangas@enterprisedb.com> wrote:
>> I don't think POSIX_FADV_DONTNEED does what you think it does. It
>> tells the kernel that "you don't need to keep these pages in the cache
>> anymore, I won't be accessing them anymore". If you call it when you
>> open the file, before reading/writing, there is nothing in the cache
>> and the call will do nothing.
>
> Oops, my bad. I think I was confused by the short description in the man
> page. I didn't read the longer descriptoon. :( Then would it be worth
> making the this call after the file is zeroed out?

Not sure. If you're churning through WAL files at a reasonable speed, 
the zeroed-out file will soon be written to again. OTOH, we always write 
whole pages, so maybe the OS is smart enough to not read the page back 
to memory just to overwrite it.

In a steady-state situation new WAL files are not created very often 
because we recycle old ones, so it probably doesn't make much difference.

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Command to prune archive at restartpoints
Next
From: Tom Lane
Date:
Subject: Re: fix use of posix_fadvise in xlog.c