From: | Kirk Wolak <wolakk(at)gmail(dot)com> |
---|---|
To: | Nikolay Samokhvalov <nik(at)postgres(dot)ai> |
Cc: | pgsql-hackers mailing list <pgsql-hackers(at)postgresql(dot)org>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
Subject: | Re: Add --system-identifier / -s option to pg_resetwal |
Date: | 2025-05-31 19:31:09 |
Message-ID: | CACLU5mQ2pBbS-s78BXGkjEW9=vy_yQyiY2YCuOwFV0NpassOAA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, May 31, 2025 at 2:52 PM Nikolay Samokhvalov <nik(at)postgres(dot)ai> wrote:
> I was just involved in a DR case, where we needed to change system ID in
> control data, and noticed that there is no such capability, officially – so
> I thought, it would be good to have it
>
> the attached patch adds a new -s / --system-identifier option to
> pg_resetwal that allows users to change the database cluster's system
> identifier; it can be useful when you need to make a restored cluster
> distinct from the original, or when cloning for testing
>
> some aspects about the patch:
> - accepts positive 64-bit integers only (zero not allowed)
> - requires interactive confirmation or --force flag for safety
> - detects non-TTY environments and requires --force in scripts
> - included input validation and error handling
> - updated docs with clear warnings about compatibility
> - added tests, including some edge cases
>
> looking forward to hearing feedback!
>
+1
Like the idea. I did a manual code review. It's a small patch, very
focused, and includes the proper docs.
It's very well thought out (I Iike the --force requirement for scripts).
The only thing I saw was that the code basically accepts Y or y, and all
else is considered "N". for that reason,
I suggest that this line:
printf(_("Continue? (y/n) "));
Would be more clear as:
printf(_("Continue? (y/n) [n]"));
indicating the N is the default answer. if you put anything other than Y
or y... N will be picked.
But this is almost trivial, but I wanted to be thorough.
Regards!
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2025-05-31 20:33:56 | Confused coding in PLy_traceback() |
Previous Message | Nikolay Samokhvalov | 2025-05-31 18:52:19 | Add --system-identifier / -s option to pg_resetwal |