pgsql: Add file_extend_method=posix_fallocate,write_zeros.

Started by Thomas Munro2 months ago3 messageshackers
Jump to latest
#1Thomas Munro
thomas.munro@gmail.com

Add file_extend_method=posix_fallocate,write_zeros.

Provide a way to disable the use of posix_fallocate() for relation
files. It was introduced by commit 4d330a61bb1. The new setting
file_extend_method=write_zeros can be used as a workaround for problems
reported from the field:

* BTRFS compression is disabled by the use of posix_fallocate()
* XFS could produce spurious ENOSPC errors in some Linux kernel
versions, though that problem is reported to have been fixed

The default is file_extend_method=posix_fallocate if available, as
before. The write_zeros option is similar to PostgreSQL < 16, except
that now it's multi-block.

Backpatch-through: 16
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>
Reported-by: Dimitrios Apostolou <jimis@gmx.net>
Discussion: /messages/by-id/b1843124-fd22-e279-a31f-252dffb6fbf2@gmx.net

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/33e3de6d77e87d6c3c6f8f878dd8de42d37c3b8f

Modified Files
--------------
doc/src/sgml/config.sgml | 37 +++++++++++++++++++++++++++
src/backend/storage/file/fd.c | 3 +++
src/backend/storage/smgr/md.c | 21 +++++++++++----
src/backend/utils/misc/guc_tables.c | 19 ++++++++++++++
src/backend/utils/misc/postgresql.conf.sample | 4 +++
src/include/storage/fd.h | 11 ++++++++
6 files changed, 90 insertions(+), 5 deletions(-)

#2Michael Paquier
michael@paquier.xyz
In reply to: Thomas Munro (#1)
Re: pgsql: Add file_extend_method=posix_fallocate,write_zeros.

Hi Thomas,

On Fri, Feb 06, 2026 at 05:09:54AM +0000, Thomas Munro wrote:

Add file_extend_method=posix_fallocate,write_zeros.

It looks like you need to update .abi-compliance-check for stable
branches down to v16, due to the new entry added to
ConfigureNamesEnum. See:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=crake&amp;dt=2026-02-06%2009%3A27%3A27
--
Michael

#3Thomas Munro
thomas.munro@gmail.com
In reply to: Michael Paquier (#2)
Re: pgsql: Add file_extend_method=posix_fallocate,write_zeros.

On Sat, Feb 7, 2026 at 12:30 AM Michael Paquier <michael@paquier.xyz> wrote:

On Fri, Feb 06, 2026 at 05:09:54AM +0000, Thomas Munro wrote:

Add file_extend_method=posix_fallocate,write_zeros.

It looks like you need to update .abi-compliance-check for stable
branches down to v16, due to the new entry added to
ConfigureNamesEnum. See:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=crake&amp;dt=2026-02-06%2009%3A27%3A27

Ahh, right, I see (I was asking about this on the patch thread, as I
hadn't had to do that before). Will do in a few hours, sorry for the
build farm noise. Thanks!