Re: Bug in MultiXact replay compat logic for older minor version after crash-recovery

x4mmm@yandex-team.ru

From: Andrey Borodin <x4mmm@yandex-team.ru>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: "段坤仁(刻韧)" <duankunren.dkr@alibaba-inc.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2026-03-20T17:05:53Z
Lists: pgsql-hackers

> On 20 Mar 2026, at 18:14, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
> 
> Zeroing the page again is dangerous because the CREATE_ID records can be out of order. The page might already contain some later multixids, and zeroing will overwrite them.

I see only cases when it's not a problem: we zeroed page, did not flush it, thus did not extend the file, crashed, tested FS, zeroed page once more, overwrote again by replaying WAL, no big deal.
We should never zero a page with offsets, that will not be replayed by WAL.

If the page was persisted, even partially, we will read it from disk without zeroing out.


Best regards, Andrey Borodin.


Commits

  1. Fix multixact backwards-compatibility with CHECKPOINT race condition

  2. Don't reset 'latest_page_number' when replaying multixid truncation