| From: | Maxim Orlov <orlovmg(at)gmail(dot)com> |
|---|---|
| To: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | mxid and mxoff wraparound issues in pg_upgrade |
| Date: | 2025-06-20 15:45:28 |
| Message-ID: | CACG=ezaApSMTjd=M2Sfn5Ucuggd3FG8Z8Qte8Xq9k5-+RQis-g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi!
I've noticed two bugs reported [0] and [1] which are both related to the
wraparound of mxid and
mxoff. Problems for mxid and mxoff are minor, as they require hitting the
exact overflow limit to
occur. But it's better to correct it.
I included a test to reproduce the problem (see 0001). It is not intended
to be committed, I
guess. I then added a commit with a fix.
There two fixes.
1) pg_upgrade does not consider the mxid to be in a wraparound state. In
this case, I adjust
the mxid value to the FirstMultiXactId. Alternatively, it might be
conceivable to include the
ability to set InvalidMultiXactId in pg_resetwal, but this seems odd to
me.
2) pg_resetwall forbids to set mxoff to UINT_MAX32. I'm not sure if this
was done on
purpose or not, but perhaps this check can be removed.
Here is what I've got with the fix applied.
>>> before upgrade:
Latest checkpoint's NextMultiXactId: 0
Latest checkpoint's NextMultiOffset: 4294967295
Latest checkpoint's oldestMultiXid: 4294967295
>>> after upgrade:
Latest checkpoint's NextMultiXactId: 1
Latest checkpoint's NextMultiOffset: 4294967295
Latest checkpoint's oldestMultiXid: 4294967295
Thoughts?
[0]
https://www.postgresql.org/message-id/18863-72f08858855344a2%40postgresql.org
[1]
https://www.postgresql.org/message-id/18865-d4c66cf35c2a67af%40postgresql.org
--
Best regards,
Maxim Orlov.
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Test-case-for-BUG-18863-and-BUG-18865.patch | application/octet-stream | 3.8 KB |
| v1-0002-Fix-the-mxid-and-mxoff-wraparound-issues-in-pg_up.patch | application/octet-stream | 2.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shihao zhong | 2025-06-20 15:54:07 | Re: Fixes inconsistent behavior in vacuum when it processes multiple relations |
| Previous Message | Tom Lane | 2025-06-20 15:20:43 | Re: Removing rm regress.def |