Re: [PING] fallocate() causes btrfs to never compress postgresql files
Thomas Munro <thomas.munro@gmail.com>
From: Thomas Munro <thomas.munro@gmail.com>
To: Dimitrios Apostolou <jimis@gmx.net>
Cc: Tomas Vondra <tomas@vondra.me>, pgsql-hackers@lists.postgresql.org, Andres Freund <andres@anarazel.de>,
Melanie Plageman <melanieplageman@gmail.com>, Heikki Linnakangas <hlinnaka@iki.fi>,
Kyotaro Horiguchi <horikyota.ntt@gmail.com>, David Rowley <dgrowleyml@gmail.com>,
John Naylor <john.naylor@enterprisedb.com>
Date: 2025-05-31T14:00:17Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add file_extend_method=posix_fallocate,write_zeros.
- e37b59802846 16.12 landed
- 4dac22aa10d2 17.8 landed
- f94e9141a0bb 19 (unreleased) landed
- 33e3de6d77e8 18.2 landed
-
Add smgrzeroextend(), FileZero(), FileFallocate()
- 4d330a61bb19 16.0 cited
Attachments
- 0001-Add-io_min_fallocate-setting.patch (text/x-patch) patch 0001
- 0002-Add-io_min_fallocate-tablespace-option.patch (text/x-patch) patch 0002
On Fri, May 30, 2025 at 3:58 AM Dimitrios Apostolou <jimis@gmx.net> wrote: > All I'm saying is that this is a regression for PostgreSQL users that keep > tablespaces on compressed Btrfs. What could be done from postgres, is to > provide a runtime setting for avoiding fallocate(), going instead through > the old code path. Idelly this would be an option per tablespace, but even > a global one is better than nothing. Here's an initial sketch of such a setting. Better name, design, words welcome. Would need a bit more work to cover temp tables too. It's slightly tricky to get smgr to behave differently because of the contents of a system catalogue! I couldn't think of a better way than exposing it as a flag that the buffer manager layer has to know about and compute earlier, but that also seems a bit strange, as fallocate is a highly md.c specific concern. Hmm. I suppose something like the 0001 part could be back-patched if this is considered a serious enough problem without other workarounds, so I did this in two steps. I wonder if there are good reasons to want to change the number on other file systems. I suppose it at least allows experimentation.