Re: Data corruption: checkpoint can lose a multixact created during its start

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: shihao zhong <zhong950419(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Data corruption: checkpoint can lose a multixact created during its start
Date: 2026-11-03 00:11:32
Message-ID: 5d949571-8035-4132-a68a-68badc4d3f15@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 30/10/2026 05:09, shihao zhong wrote:
> MultiXactIdCreateFromMembers() inserts the CREATE_ID record before it
> fills the SLRU pages. A checkpoint can take its redo pointer in between
> and flush the pages first. After a crash, recovery starts after
> passing the record and
> the multixact has no members. In a non-assert build the old row version
> becomes visible again next to the new one.

Good catch. Interesting that we recognized that problem in
TruncateMultiXact(), but missed it in the much more frequently used
MultiXactIdCreateFromMembers() function.

> 0001 sets DELAY_CHKPT_START around the two steps, like
> TruncateMultiXact(). 0002 is the repro.
>
> 0001 applies to 15 and up. 14 needs the old delayChkpt flag. The test
> needs 18 and up.

I applied the fix down to v14, thanks!

I left out the test, it seemed a bit heavy to memorize forever, this
particular bug seems unlikely to re-appear in exactly the same form, and
injection point tests like this don't generalize well. But thanks for
including it anyway, a repro is always useful even if it doesn't get
included in the regression suite.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message shihao zhong 2026-11-03 00:17:26 Re: Data corruption: checkpoint can lose a multixact created during its start
Previous Message Hannu Krosing 2026-11-02 23:45:04 Re: ZSTD TOAST compression, and an extensible compression method encoding