You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
smgrzeroextend() uses FileFallocate() to efficiently extend files by multipleblocks. When extending by a small number of blocks, use FileZero() instead, asusing posix_fallocate() for small numbers of blocks is inefficient for somefile systems / operating systems. FileZero() is also used as the fallback forFileFallocate() on platforms / filesystems that don't support fallocate.A big advantage of using posix_fallocate() is that it typically won't causedirty buffers in the kernel pagecache. So far the most common pattern in ourcode is that we smgrextend() a page full of zeroes and put the correspondingpage into shared buffers, from where we later write out the actual contents ofthe page. If the kernel, e.g. due to memory pressure or elapsed time, alreadywrote back the all-zeroes page, this can lead to doubling the amount of writesreaching storage.There are no users of smgrzeroextend() as of this commit. That will follow infuture commits.Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>Reviewed-by: David Rowley <dgrowleyml@gmail.com>Reviewed-by: John Naylor <john.naylor@enterprisedb.com>Discussion:https://postgr.es/m/20221029025420.eplyow6k7tgu6he3@awork3.anarazel.de