pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix multixact backwards-compatibility with CHECKPOINT race condi 5+ messages / 1 participants [nested] [flat]
* pgsql: Fix multixact backwards-compatibility with CHECKPOINT race condi @ 2026-03-23 10:35 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 5+ messages in thread From: Heikki Linnakangas @ 2026-03-23 10:35 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix multixact backwards-compatibility with CHECKPOINT race condition If a CHECKPOINT record with nextMulti N is written to the WAL before the CREATE_ID record for N, and N happens to be the first multixid on an offset page, the backwards compatibility logic to tolerate WAL generated by older minor versions (before commit 789d65364c) failed to compensate for the missing XLOG_MULTIXACT_ZERO_OFF_PAGE record. In that case, the latest_page_number was initialized at the start of WAL replay to the page for nextMulti from the CHECKPOINT record, even if we had not seen the CREATE_ID record for that multixid yet, which fooled the backwards compatibility logic to think that the page was already initialized. To fix, track the last XLOG_MULTIXACT_ZERO_OFF_PAGE that we've seen separately from latest_page_number. If we haven't seen any XLOG_MULTIXACT_ZERO_OFF_PAGE records yet, use SimpleLruDoesPhysicalPageExist() to check if the page needs to be initialized. Reported-by: duankunren.dkr <duankunren.dkr@alibaba-inc.com> Analyzed-by: duankunren.dkr <duankunren.dkr@alibaba-inc.com> Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru> Reviewed-by: Kirill Reshke <reshkekirill@gmail.com> Discussion: https://www.postgresql.org/message-id/c4ef1737-8cba-458e-b6fd-4e2d6011e985.duankunren.dkr@alibaba-in... Backpatch-through: 14-18 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0852643e1c60f3d32f723cac06e7a16f147745aa Modified Files -------------- src/backend/access/transam/multixact.c | 87 +++++++++++++++++++++++++++------- src/include/access/slru.h | 4 +- 2 files changed, 70 insertions(+), 21 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix multixact backwards-compatibility with CHECKPOINT race condi @ 2026-03-23 10:35 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 5+ messages in thread From: Heikki Linnakangas @ 2026-03-23 10:35 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix multixact backwards-compatibility with CHECKPOINT race condition If a CHECKPOINT record with nextMulti N is written to the WAL before the CREATE_ID record for N, and N happens to be the first multixid on an offset page, the backwards compatibility logic to tolerate WAL generated by older minor versions (before commit 789d65364c) failed to compensate for the missing XLOG_MULTIXACT_ZERO_OFF_PAGE record. In that case, the latest_page_number was initialized at the start of WAL replay to the page for nextMulti from the CHECKPOINT record, even if we had not seen the CREATE_ID record for that multixid yet, which fooled the backwards compatibility logic to think that the page was already initialized. To fix, track the last XLOG_MULTIXACT_ZERO_OFF_PAGE that we've seen separately from latest_page_number. If we haven't seen any XLOG_MULTIXACT_ZERO_OFF_PAGE records yet, use SimpleLruDoesPhysicalPageExist() to check if the page needs to be initialized. Reported-by: duankunren.dkr <duankunren.dkr@alibaba-inc.com> Analyzed-by: duankunren.dkr <duankunren.dkr@alibaba-inc.com> Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru> Reviewed-by: Kirill Reshke <reshkekirill@gmail.com> Discussion: https://www.postgresql.org/message-id/c4ef1737-8cba-458e-b6fd-4e2d6011e985.duankunren.dkr@alibaba-in... Backpatch-through: 14-18 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/1ca38503219abf6b291c47c7586a8a82f8014f8d Modified Files -------------- src/backend/access/transam/multixact.c | 87 +++++++++++++++++++++++++++------- src/include/access/slru.h | 4 +- 2 files changed, 70 insertions(+), 21 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix multixact backwards-compatibility with CHECKPOINT race condi @ 2026-03-23 10:35 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 5+ messages in thread From: Heikki Linnakangas @ 2026-03-23 10:35 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix multixact backwards-compatibility with CHECKPOINT race condition If a CHECKPOINT record with nextMulti N is written to the WAL before the CREATE_ID record for N, and N happens to be the first multixid on an offset page, the backwards compatibility logic to tolerate WAL generated by older minor versions (before commit 789d65364c) failed to compensate for the missing XLOG_MULTIXACT_ZERO_OFF_PAGE record. In that case, the latest_page_number was initialized at the start of WAL replay to the page for nextMulti from the CHECKPOINT record, even if we had not seen the CREATE_ID record for that multixid yet, which fooled the backwards compatibility logic to think that the page was already initialized. To fix, track the last XLOG_MULTIXACT_ZERO_OFF_PAGE that we've seen separately from latest_page_number. If we haven't seen any XLOG_MULTIXACT_ZERO_OFF_PAGE records yet, use SimpleLruDoesPhysicalPageExist() to check if the page needs to be initialized. Reported-by: duankunren.dkr <duankunren.dkr@alibaba-inc.com> Analyzed-by: duankunren.dkr <duankunren.dkr@alibaba-inc.com> Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru> Reviewed-by: Kirill Reshke <reshkekirill@gmail.com> Discussion: https://www.postgresql.org/message-id/c4ef1737-8cba-458e-b6fd-4e2d6011e985.duankunren.dkr@alibaba-in... Backpatch-through: 14-18 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/77dff5d937b192b85c55bce822e7413ff7dda6eb Modified Files -------------- src/backend/access/transam/multixact.c | 83 +++++++++++++++++++++++++++------- src/include/access/slru.h | 4 +- 2 files changed, 68 insertions(+), 19 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix multixact backwards-compatibility with CHECKPOINT race condi @ 2026-03-23 10:35 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 5+ messages in thread From: Heikki Linnakangas @ 2026-03-23 10:35 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix multixact backwards-compatibility with CHECKPOINT race condition If a CHECKPOINT record with nextMulti N is written to the WAL before the CREATE_ID record for N, and N happens to be the first multixid on an offset page, the backwards compatibility logic to tolerate WAL generated by older minor versions (before commit 789d65364c) failed to compensate for the missing XLOG_MULTIXACT_ZERO_OFF_PAGE record. In that case, the latest_page_number was initialized at the start of WAL replay to the page for nextMulti from the CHECKPOINT record, even if we had not seen the CREATE_ID record for that multixid yet, which fooled the backwards compatibility logic to think that the page was already initialized. To fix, track the last XLOG_MULTIXACT_ZERO_OFF_PAGE that we've seen separately from latest_page_number. If we haven't seen any XLOG_MULTIXACT_ZERO_OFF_PAGE records yet, use SimpleLruDoesPhysicalPageExist() to check if the page needs to be initialized. Reported-by: duankunren.dkr <duankunren.dkr@alibaba-inc.com> Analyzed-by: duankunren.dkr <duankunren.dkr@alibaba-inc.com> Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru> Reviewed-by: Kirill Reshke <reshkekirill@gmail.com> Discussion: https://www.postgresql.org/message-id/c4ef1737-8cba-458e-b6fd-4e2d6011e985.duankunren.dkr@alibaba-in... Backpatch-through: 14-18 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/a5f412107f98721bd8cd624a05d5e7b4df99d7a8 Modified Files -------------- src/backend/access/transam/multixact.c | 83 +++++++++++++++++++++++++++------- src/include/access/slru.h | 4 +- 2 files changed, 68 insertions(+), 19 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix multixact backwards-compatibility with CHECKPOINT race condi @ 2026-03-23 10:35 Heikki Linnakangas <heikki.linnakangas@iki.fi> 0 siblings, 0 replies; 5+ messages in thread From: Heikki Linnakangas @ 2026-03-23 10:35 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix multixact backwards-compatibility with CHECKPOINT race condition If a CHECKPOINT record with nextMulti N is written to the WAL before the CREATE_ID record for N, and N happens to be the first multixid on an offset page, the backwards compatibility logic to tolerate WAL generated by older minor versions (before commit 789d65364c) failed to compensate for the missing XLOG_MULTIXACT_ZERO_OFF_PAGE record. In that case, the latest_page_number was initialized at the start of WAL replay to the page for nextMulti from the CHECKPOINT record, even if we had not seen the CREATE_ID record for that multixid yet, which fooled the backwards compatibility logic to think that the page was already initialized. To fix, track the last XLOG_MULTIXACT_ZERO_OFF_PAGE that we've seen separately from latest_page_number. If we haven't seen any XLOG_MULTIXACT_ZERO_OFF_PAGE records yet, use SimpleLruDoesPhysicalPageExist() to check if the page needs to be initialized. Reported-by: duankunren.dkr <duankunren.dkr@alibaba-inc.com> Analyzed-by: duankunren.dkr <duankunren.dkr@alibaba-inc.com> Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru> Reviewed-by: Kirill Reshke <reshkekirill@gmail.com> Discussion: https://www.postgresql.org/message-id/c4ef1737-8cba-458e-b6fd-4e2d6011e985.duankunren.dkr@alibaba-in... Backpatch-through: 14-18 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/e35e466f61b358f88f20fbebd3996c50589a6663 Modified Files -------------- src/backend/access/transam/multixact.c | 83 +++++++++++++++++++++++++++------- src/include/access/slru.h | 4 +- 2 files changed, 68 insertions(+), 19 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2026-03-23 10:35 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-03-23 10:35 pgsql: Fix multixact backwards-compatibility with CHECKPOINT race condi Heikki Linnakangas <heikki.linnakangas@iki.fi> 2026-03-23 10:35 pgsql: Fix multixact backwards-compatibility with CHECKPOINT race condi Heikki Linnakangas <heikki.linnakangas@iki.fi> 2026-03-23 10:35 pgsql: Fix multixact backwards-compatibility with CHECKPOINT race condi Heikki Linnakangas <heikki.linnakangas@iki.fi> 2026-03-23 10:35 pgsql: Fix multixact backwards-compatibility with CHECKPOINT race condi Heikki Linnakangas <heikki.linnakangas@iki.fi> 2026-03-23 10:35 pgsql: Fix multixact backwards-compatibility with CHECKPOINT race condi Heikki Linnakangas <heikki.linnakangas@iki.fi>
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