pg_resetwal: Fix handling of commit timestamp XIDs

Started by Chao Liabout 2 months ago3 messageshackers
Jump to latest
#1Chao Li
li.evan.chao@gmail.com

Hi,

While working on patch [1]/messages/by-id/F7B47D8D-BFCB-464F-A737-DA796AE69D91@gmail.com, I spotted two small issues in pg_resetwal.

1. The -c option accepts two XIDs. The first is parsed by strtouint32_strict(), but the second is parsed by strtoul(). This seems to be an oversight in 636c1914b48, which introduced strtouint32_strict().

2. The help message for the -c option says that “zero means no change”, but this behavior is missing on the current master branch. I checked the git history, and the behavior was lost in 978cf02bb8c, which added separate “given” flags for command-line options.

The fixes for both issues are tiny. See the attached patch for details.

Unfortunately, I reviewed both patches but didn't notice these issues at the time. Both commits were included in PG19, so this might be worth back-patching to 19.

[1]: /messages/by-id/F7B47D8D-BFCB-464F-A737-DA796AE69D91@gmail.com

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachments:

t253986_1
v1-0001-pg_resetwal-Fix-handling-of-commit-timestamp-XIDs.patchapplication/octet-stream; name=v1-0001-pg_resetwal-Fix-handling-of-commit-timestamp-XIDs.patch; x-unix-mode=0644Download+5-4
#2Heikki Linnakangas
hlinnaka@iki.fi
In reply to: Chao Li (#1)
Re: pg_resetwal: Fix handling of commit timestamp XIDs

On 29/09/2026 09:09, Chao Li wrote:

Hi,

While working on patch [1], I spotted two small issues in pg_resetwal.

1. The -c option accepts two XIDs. The first is parsed by strtouint32_strict(), but the second is parsed by strtoul(). This seems to be an oversight in 636c1914b48, which introduced strtouint32_strict().

2. The help message for the -c option says that “zero means no change”, but this behavior is missing on the current master branch. I checked the git history, and the behavior was lost in 978cf02bb8c, which added separate “given” flags for command-line options.

The fixes for both issues are tiny. See the attached patch for details.

Unfortunately, I reviewed both patches but didn't notice these issues at the time. Both commits were included in PG19, so this might be worth back-patching to 19.

Pushed, thanks!

- Heikki

#3Chao Li
li.evan.chao@gmail.com
In reply to: Heikki Linnakangas (#2)
Re: pg_resetwal: Fix handling of commit timestamp XIDs

On Sep 29, 2026, at 21:50, Heikki Linnakangas <hlinnaka@iki.fi> wrote:

On 29/09/2026 09:09, Chao Li wrote:

Hi,
While working on patch [1], I spotted two small issues in pg_resetwal.
1. The -c option accepts two XIDs. The first is parsed by strtouint32_strict(), but the second is parsed by strtoul(). This seems to be an oversight in 636c1914b48, which introduced strtouint32_strict().
2. The help message for the -c option says that “zero means no change”, but this behavior is missing on the current master branch. I checked the git history, and the behavior was lost in 978cf02bb8c, which added separate “given” flags for command-line options.
The fixes for both issues are tiny. See the attached patch for details.
Unfortunately, I reviewed both patches but didn't notice these issues at the time. Both commits were included in PG19, so this might be worth back-patching to 19.

Pushed, thanks!

- Heikki

Hi Heikki, thanks for pushing.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/