Re: fix use of posix_fadvise in xlog.c

From: Mark Wong <markwkm(at)gmail(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: fix use of posix_fadvise in xlog.c
Date: 2010-06-10 15:17:19
Message-ID: F5CE985E-CA7B-4723-BBA2-0EC414127B90@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Jun 9, 2010, at 11:25 PM, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com
> wrote:

> On 10/06/10 06:47, Mark Wong wrote:
>> I wanted to propose a fix for to xlog.c regarding the use of
>> posix_fadvise() for 9.1 (unless someone feels it's ok for 9.0).
>> Currently posix_fadvise() is used right before a log file is closed
>> so
>> it's effectively not doing anything, when posix_fadvise is to be
>> called. This patch moves the posix_fadvise() call into 3 other
>> locations within XLogFileInit() where a file handle is returned. The
>> first case is where an existing open file handle is returned. The
>> next case is when a file is to be zeroed out. The third case is
>> returning a file handle, which may be the file that was just zeroed
>> out.
>
> 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?

Regards,
Mark

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2010-06-10 15:19:18 Re: Command to prune archive at restartpoints
Previous Message Kevin Grittner 2010-06-10 15:15:53 Re: Large (almost 50%!) performance drop after upgrading to 8.4.4?