Re: fallocate / posix_fallocate for new WAL file creation (etc...) - Mailing list pgsql-hackers

From Greg Smith
Subject Re: fallocate / posix_fallocate for new WAL file creation (etc...)
Date
Msg-id 51A563AE.2090507@2ndQuadrant.com
Whole thread Raw
In response to Re: fallocate / posix_fallocate for new WAL file creation (etc...)  (Jon Nelson <jnelson+pgsql@jamponi.net>)
Responses Re: fallocate / posix_fallocate for new WAL file creation (etc...)  (Jeff Davis <pgsql@j-davis.com>)
List pgsql-hackers
On 5/28/13 10:00 PM, Jon Nelson wrote:
> On Tue, May 28, 2013 at 10:36 AM, Greg Smith <greg@2ndquadrant.com> wrote:
>> On 5/28/13 11:12 AM, Jon Nelson wrote:
>>>
>>> It opens a new file, fallocates 16MB, calls fdatasync.
>>
>>
>> Outside of the run for performance testing, I think it would be good at this
>> point to validate that there is really a 16MB file full of zeroes resulting
>> from these operations.  I am not really concerned that posix_fallocate might
>> be slower in some cases; that seems unlikely.  I am concerned that it might
>> result in a file that isn't structurally the same as the 16MB of zero writes
>> implementation used now.
>
> util-linux comes with fallocate which (might?) suffice for testing in
> that respect, no?
> If that is a real concern, it could be made part of the autoconf
> testing, perhaps.

I was just thinking of something to run in your test program, not 
another build time check.  Just run the new allocation sequence, and 
then check the resulting WAL file for a) correct length, and b) 16K of 
zero bytes.  I would like to build some confidence that posix_fallocate 
is operating correctly in this context on at least one platform.  My 
experience with Linux handling this class of functions correctly has 
left me skeptical of them working until that's proven to be the case.

-- 
Greg Smith   2ndQuadrant US    greg@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.com



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: preserving forensic information when we freeze
Next
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] pg_upgrade -u