Re: posix_fadvsise in base backups - Mailing list pgsql-hackers

From Magnus Hagander
Subject Re: posix_fadvsise in base backups
Date
Msg-id CABUevEwH5rq1H1+zfPBr6xPQ2EsotBxy+E6JNm+Rt-FGPeeogw@mail.gmail.com
Whole thread Raw
In response to Re: posix_fadvsise in base backups  (Andres Freund <andres@anarazel.de>)
Responses Re: posix_fadvsise in base backups
Re: posix_fadvsise in base backups
List pgsql-hackers
On Sat, Sep 24, 2011 at 17:14, Andres Freund <andres@anarazel.de> wrote:
> Hi,
>
> On Saturday, September 24, 2011 05:08:17 PM Magnus Hagander wrote:
>> Attached patch adds a simple call to posix_fadvise with
>> POSIX_FADV_DONTNEED on all the files being read when doing a base
>> backup, to help the kernel not to trash the filesystem cache.
>>
>> Seems like a simple enough fix - in fact, I don't remember why I took
>> it out of the original patch :O
>>
>> Any reason not to put this in? Is it even safe enough to put into 9.1
>> (probably not, but maybe?)
> Won't that possibly throw a formerly fully cached database out of the cache?

I was assuming the kernel was smart enough to read this as "*this*
process is not going to be using this file anymore", not "nobody in
the whole machine is going to use this file anymore". And the process
running the base backup is certainly not going to read it again.

But that's a good point - do you know if that is the case, or does it
mandate more testing?


--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: posix_fadvsise in base backups
Next
From: Tom Lane
Date:
Subject: Re: Large C files