Re: Why clearing the VM doesn't require registering vm buffer in wal record

From: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
To: Melanie Plageman <melanieplageman(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Subject: Re: Why clearing the VM doesn't require registering vm buffer in wal record
Date: 2026-03-05 20:23:12
Message-ID: CAEze2Wh7f1zA7xQ8tR4pfuSUj6SuuVOcN5_+PkZP-69f+u-wFQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 5 Mar 2026 at 20:56, Melanie Plageman <melanieplageman(at)gmail(dot)com> wrote:
>
> Today Andres and I noticed that heap_{update,insert,delete}() don't
> register the VM buffer when they are clearing the VM. I was under the
> impression that any buffers modified needed to be registered in the
> WAL record. Without which, you'll never do an FPI. It seems like this
> could cause checksum failures. What are we missing?

Might it be, because zeroing a VM page (which you would do when you
encounter checksum failures) is an MVCC-safe operation?

I agree with you that we probably _should_ register the VM (and
possibly FSM) buffer, but that's a bit of a different story. Right
now, the VM does not use the standard page format (nor does the FSM),
and therefore every FPI would be the full 8KB, even when just a few
bits of the VM page are in use; which would be a rather large waste of
space.

On Thu, 5 Mar 2026 at 21:16, Andres Freund <andres(at)anarazel(dot)de> wrote:
>
> But it does seem like it could be a problem for incremental backup /
> walsummarizer?

I don't think it is, because that doesn't do calculations for non-main
forks, it considers those forks always changed and includes them in
full. Or at least, that was the response I got when I raised concerns
about the FSM back when the incremental backup feature was being
developed [0].

Kind regards,

Matthias van de Meent
Databricks (https://databricks.com)

[0] https://postgr.es/m/CA%2BTgmoaR8o%2BPBeWc_2Ge0XVgoM7xWKNyDmqXoTov%3DS6_J1gecQ%40mail.gmail.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2026-03-05 20:25:25 Re: gistGetFakeLSN() can return incorrect LSNs
Previous Message Corey Huinker 2026-03-05 20:20:07 Re: Add expressions to pg_restore_extended_stats()