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. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers