pg_resetwal prints new OldestXID in wrong circumstances

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: pg_resetwal prints new OldestXID in wrong circumstances
Date: 2025-11-19 09:52:31
Message-ID: 5461bc85-e684-4531-b4d2-d2e57ad18cba@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

When the --oldest-transaction-id option is used, pg_resetwal doesn't
print the new value like it does for other similar options. For example,
if you use --next-oid and --oldest-transaction-id, only the new NextOID
value is printed:

> $ pg_resetwal --dry-run -D data --next-oid 10 --oldest-transaction-id 100
> Current pg_control values:
>
> ...
>
> Values to be changed:
>
> First log segment after reset: 000000010000000000000005
> NextOID: 10

Printing the new OldestXID value is incorrectly tied to whether the
--next-transaction-id option is given, so this prints it, even though
OldestXID is not being modified:

> $ pg_resetwal --dry-run -D data --next-oid 10 --next-transaction-id 100
> Current pg_control values:
>
> ...
>
>
> Values to be changed:
>
> First log segment after reset: 000000010000000000000005
> NextOID: 10
> NextXID: 100
> OldestXID: 744
> OldestXID's DB: 1

This seems to have been an oversight when the --oldest-transaction-id
option was added (commit 74cf7d46a91d). Before that, OldestXID was reset
when the --next-transaction-id option was given.

Fix attached. Barring objections, I will commit and backpatch this.

- Heikki

Attachment Content-Type Size
0001-Print-new-OldestXID-value-in-pg_resetwal-when-it-s-b.patch text/x-patch 1.1 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message S, Naveen Krishna (Development Engineer 3) 2025-11-19 09:54:41 Re: [EXTERNAL] Re: BUG #19114: ORDER BY ASC is tampering result when calculating distance btw vectors
Previous Message BharatDB 2025-11-19 09:08:37 Re: BUG #19095: Test if function exit() is used fail when linked static