Re: POC: make mxidoff 64 bits

From: Maxim Orlov <orlovmg(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: wenhui qiu <qiuwenhuifx(at)gmail(dot)com>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: POC: make mxidoff 64 bits
Date: 2025-11-06 15:50:23
Message-ID: CACG=ezbZo_3_fnx=S5BfepwRftzrpJ+7WET4EkTU6wnjDTsnjg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 5 Nov 2025 at 18:38, Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:

>
> Remaining issues:
>
> - There's one more refactoring I'd like to do before merging this: Move
> the definitions that are now duplicated between
> src/bin/pg_upgrade/multixact_new.c and
> src/backend/access/transam/multixact.c into a new header file,
> multixact_internal.h. One complication with that is that it needs
> SLRU_PAGES_PER_SEGMENT ...

Done. Also put SLRU_PAGES_PER_SEGMENT in pg_config_manual.h
In my opinion, this constant perfectly aligns the description in the
file header. In any case, feel free to move it anywhere you like.

- Have you done any performance testing of the pg_upgrade code? How long
> does the conversion take if you have e.g. 1 billion multixids?
>
Unfortunately, not yet. I'd like to do this soon. Currently, the
bulk of the testing time is spent generating multi-transactions.

- Is the !oldestOffsetKnown case in the code still reachable? I left one
> FIXME comment about that. Needs a comment update at least.
>
Yep, no longer needed. A separate commit has been added.

- The new pg_upgrade test fails on my system with this error in the log:

Unfortunately, I don't face this issue. I think this can be fixed by
providing an explicit path to the utility.

- The new pg_ugprade test is very slow. I would love to include that
> test permanently in the test suite, but it's too slow for that currently.

Yes, unfortunately. The majority of the time is spent on tests that
produce multiple segments. These are cases numbered 4-th and higher.
If we remove these, the testing should be relatively fast.

I also add commit "Handle wraparound of next new multi in pg_upgrade".
Per BUG #18863 and BUG #18865

The issue is that pg_upgrade neglects to handle the wraparound of
mxact/mxoff.

We'll obviously resolve the issue with mxoff wraparound by moving to
64-bits. And the mxact bug can be easily solved with two lines of code.
Or five if you count indents and comments. Test also provided.

This commit is totally optional. If you think it deserves to be treated
as a different issue, feel free to discard it.

--
Best regards,
Maxim Orlov.

Attachment Content-Type Size
v23-0006-TEST-bump-catversion.patch.txt text/plain 775 bytes
v23-0001-Use-64-bit-multixact-offsets.patch application/octet-stream 44.8 KB
v23-0005-Handle-wraparound-of-next-new-multi-in-pg_upgrad.patch application/octet-stream 6.0 KB
v23-0002-Add-pg_upgarde-for-64-bit-multixact-offsets.patch application/octet-stream 30.1 KB
v23-0003-Remove-oldestOffset-oldestOffsetKnown-from-multi.patch application/octet-stream 6.1 KB
v23-0004-Add-test-for-64-bit-mxoff-in-pg_resetwal.patch application/octet-stream 4.9 KB
v23-0007-TEST-Add-test-for-64-bit-mxoff-in-pg_upgrade.patch.txt text/plain 11.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2025-11-06 16:01:15 Re: log_min_messages per backend type
Previous Message Álvaro Herrera 2025-11-06 15:48:31 Re: [PATCH] Add pg_get_subscription_ddl() function