Re: mxid and mxoff wraparound issues in pg_upgrade
Heikki Linnakangas <hlinnaka@iki.fi>
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Maxim Orlov <orlovmg@gmail.com>,
Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-11-12T11:14:00Z
Lists: pgsql-hackers
On 05/11/2025 14:15, Heikki Linnakangas wrote: > I propose the attached fix. It adds separate booleans to pg_resetwal to > track whether -m or -O option was given, and allows 0 for the next > multixid and UINT32_MAX for next multixact offset. Committed, with one more change: I replaced strtoul() with strtoi64() in parsing the multixact offset. strtoul() silently casts negative values to positive ones, which means that even before this patch, we accepted any negative value, except for -1 which was checked specifically. That's bogus, and with the previous patch I posted, we would start accepting -1 too, which makes it even worse. By using strtoi64() and converting to uint32 explicitly, we now check and error out on all negative values. We have the same issue with all the other flags that use strtoul(), but I didn't want to touch those right now, especially in back-branches. But I also didn't want to start accepting -1 for -O. On 'master' I think it would make sense to tighten up the other flags, too. I don't plan to work on that myself but would be happy to review if someone writes the patch. I didn't commit the new pg_upgrade test case, but many thanks for providing it. It was very helpful in demonstrating the problem. - Heikki
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix pg_upgrade around multixid and mxoff wraparound
- 97cd4b65af6c 15.16 landed
- e039b09f8d39 16.12 landed
- cb2ef0e92edb 17.8 landed
- 8747b969fd8b 18.2 landed
- 94939c5f3ab0 19 (unreleased) landed