pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: freespace: Don't modify page without any lock
Date: Mon, 12 Jan 2026 17:43:11 +0000
Message-ID: <E1vfLwc-0004mA-1Q@gemulon.postgresql.org> (raw)

freespace: Don't modify page without any lock

Before this commit fsm_vacuum_page() modified the page without any lock on the
page. Historically that was kind of ok, as we didn't rely on the freespace to
really stay consistent and we did not have checksums. But these days pages are
checksummed and there are ways for FSM pages to be included in WAL records,
even if the FSM itself is still not WAL logged. If a FSM page ever were
modified while a WAL record referenced that page, we'd be in trouble, as the
WAL CRC could end up getting corrupted.

The reason to address this right now is a series of patches with the goal to
only allow modifications of pages with an appropriate lock level. Obviously
not having any lock is not appropriate :)

Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/4wggb7purufpto6x35fd2kwhasehnzfdy3zdcu47qryubs2hdz@fa5kannykekr
Discussion: https://postgr.es/m/e6a8f734-2198-4958-a028-aba863d4a204@iki.fi

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/45f658dacb9c2d333893fcf0d6b5a5e4f8ee5752

Modified Files
--------------
src/backend/storage/freespace/freespace.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)



Message-ID: <E1vfLwc-0004mA-1Q@gemulon.postgresql.org>
Permalink:  ../E1vfLwc-0004mA-1Q@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1vfLwc-0004mA-1Q@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: freespace: Don't modify page without any lock
  In-Reply-To: <E1vfLwc-0004mA-1Q@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox