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

From Peter Eisentraut
Subject Re: fallocate / posix_fallocate for new WAL file creation (etc...)
Date
Msg-id 51A61C85.60102@gmx.net
Whole thread Raw
In response to Re: fallocate / posix_fallocate for new WAL file creation (etc...)  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
On 5/29/13 10:42 AM, Andres Freund wrote:
> On 2013-05-29 10:36:07 -0400, Stephen Frost wrote:
>> I *really* hope that the Linux kernel, and other, folks are smart enough
>> to realize that they can't just re-use random blocks from an I/O device
>> without cleaning it first.
> 
> FWIW, posix' description about posix_fallocate() doesn't actually say
> *anything* about reading. The guarantee it makes is:
> "If posix_fallocate() returns successfully, subsequent writes to the
> specified file data shall not fail due to the lack of free space on the
> file system storage media.".
> 
> http://pubs.opengroup.org/onlinepubs/009696799/functions/posix_fallocate.html
> 
> So we don't even know whether we can read. I think that means we need to
> zero the file anyway...

We could use Linux fallocate(), which does guarantee that the file reads
back as zeroes.  Or we use posix_fallocate() and write over the first
few bytes, enough for a subsequent reader to detect that it shouldn't
read any further.

But all of this is getting very complicated for such a marginal improvement.



pgsql-hackers by date:

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