Data corruption: checkpoint can lose a multixact created during its start
Data corruption: checkpoint can lose a multixact created during its start
Hi,
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.
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.
Thanks,
Shihao
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.
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.
Thanks,
Shihao
Re: Data corruption: checkpoint can lose a multixact created during its start
От:
Heikki Linnakangas <hlinnaka@iki.fi>
Дата:
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
Re: Data corruption: checkpoint can lose a multixact created during its start
От:
shihao zhong <zhong950419@gmail.com>
Дата:
Hi Heikki,
> I applied the fix down to v14, thanks!
Thanks for committing it.
> 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.
Sorry, I should have said this more clearly in my earlier email. The test was only meant to reproduce the bug, these injections point does not need to go master at all.
Thanks,
Shihao
Thanks,
Shihao