Fix pg_upgrade around multixid and mxoff wraparound
Heikki Linnakangas <heikki.linnakangas@iki.fi>
Fix pg_upgrade around multixid and mxoff wraparound pg_resetwal didn't accept multixid 0 or multixact offset UINT32_MAX, but they are both valid values that can appear in the control file. That caused pg_upgrade to fail if you tried to upgrade a cluster exactly at multixid or offset wraparound, because pg_upgrade calls pg_resetwal to restore multixid/offset on the new cluster to the values from the old cluster. To fix, allow those values in pg_resetwal. Fixes bugs #18863 and #18865 reported by Dmitry Kovalenko. Backpatch down to v15. Version 14 has the same bug, but the patch doesn't apply cleanly there. It could be made to work but it doesn't seem worth the effort given how rare it is to hit this problem with pg_upgrade, and how few people are upgrading to v14 anymore. Author: Maxim Orlov <orlovmg@gmail.com> Discussion: https://www.postgresql.org/message-id/CACG%3DezaApSMTjd%3DM2Sfn5Ucuggd3FG8Z8Qte8Xq9k5-%2BRQis-g@mail.gmail.com Discussion: https://www.postgresql.org/message-id/18863-72f08858855344a2@postgresql.org Discussion: https://www.postgresql.org/message-id/18865-d4c66cf35c2a67af@postgresql.org Backpatch-through: 15
Files
| Path | Change | +/− |
|---|---|---|
| src/bin/pg_resetwal/pg_resetwal.c | modified | +15 −10 |
| src/bin/pg_resetwal/t/001_basic.pl | modified | +7 −5 |
Discussion
- mxid and mxoff wraparound issues in pg_upgrade 3 messages · 2025-06-20 → 2025-11-12
- BUG #18863: Multixact wraparound and pg_resetwal error "multitransaction ID (-m) must not be 0" 1 message · 2025-03-24
- BUG #18865: pg_resetwal error: multitransaction offset (-O) must not be -1 1 message · 2025-03-25