Re: Add arbitrary xid and mxid to pg_resetwal

From: Daniil Davydov <3danissimo(at)gmail(dot)com>
To: Aleksander Alekseev <aleksander(at)timescale(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add arbitrary xid and mxid to pg_resetwal
Date: 2025-03-11 03:47:24
Message-ID: CAJDiXggzZJzL7saT1TO-PcqoZbw+s33htd6_Ti1NLjqkx4sr2Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Fri, Mar 7, 2025 at 9:35 PM Aleksander Alekseev
<aleksander(at)timescale(dot)com> wrote:
> Your patch should target the `master` branch. Also please add a
> corresponding entry to the nearest open commitfest [1].

OK, thanks for the notice! I attach the v2 patch for the `master`
branch to this letter. Now you can also find it in commitfest in
System Administration topic.

On Fri, Mar 7, 2025 at 9:35 PM Aleksander Alekseev
<aleksander(at)timescale(dot)com> wrote:
> > In my opinion, this will be useful primarily to simplify testing, since at the moment you have to create segments manually (as in this article).
>
> In this case you should add a test or two that demonstrate this. As
> separate commits perhaps.

Well, I just saw that people have a request for such functionality.
More specifically, I think it's worth taking a look at the
src/test/modules/xid_wraparound.
There, the transaction counter is just jumping forward to check the
autovacuum and postgres wraparound limits. These tests are using the
`xid_wraparound` extension, but it can be replaced with
new pg_resetwal feature.
Measurements on my machine showed that the test execution time (with
advancing xid up to 10 billions with 100 millions values by step)
takes 40% less time to complete.

P.S.
v2 patch looks a bit scary, because it contains a lot of raw I/O
operations. At the moment, it is the best I came up with, but the
logic of the code (I hope) is correct.

--
Best regards,
Daniil Davydov

Attachment Content-Type Size
v2-0001-Arbitrary-xid-and-mxid-for-resetwal.patch text/x-patch 14.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2025-03-11 04:11:33 Re: Commit fest 2025-03
Previous Message vignesh C 2025-03-11 03:47:16 Re: Commitfest app release on Feb 17 with many improvements