Re: Adding a '--two-phase' option to 'pg_createsubscriber' utility.

Shubham Khanna <khannashubham1197@gmail.com>

From: Shubham Khanna <khannashubham1197@gmail.com>
To: Ajin Cherian <itsajin@gmail.com>
Cc: Shlok Kyal <shlok.kyal.oss@gmail.com>, vignesh C <vignesh21@gmail.com>, Peter Smith <smithpb2250@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-01-16T11:16:06Z
Lists: pgsql-hackers

Attachments

On Wed, Jan 15, 2025 at 3:54 PM Ajin Cherian <itsajin@gmail.com> wrote:
>
>
>
> On Wed, Jan 15, 2025 at 5:33 PM Shubham Khanna <khannashubham1197@gmail.com> wrote:
> > Previously, the warning was necessary because the 'two-phase' option
> > was not available, and users needed to be informed about the default
> > behavior regarding 'two-phase' commit. However, with the recent
> > addition of the 'two-phase' option, users can now directly configure
> > this behavior during the setup process.
> > Given this enhancement, the warning message is no longer relevant and
> > should be removed from the documentation to reflect the latest changes
> > accurately. Updating the documentation will help ensure that it aligns
> > with the current functionality and avoids any potential confusion for
> > users.
>
> Hi Shubham,
>
> Even though the documentation is updated, the actual code still gives a warning, when you try and create pg_createsubscriber with the --enable-two-phase option:
>
> pg_createsubscriber: warning: two_phase option will not be enabled for replication slots
> pg_createsubscriber: detail: Subscriptions will be created with the two_phase option disabled.  Prepared transactions will be replicated at COMMIT PREPARED.
>
> This is coming from code in check_publisher()
>
>     if (max_prepared_transactions != 0)
>     {
>         pg_log_warning("two_phase option will not be enabled for replication slots");
>         pg_log_warning_detail("Subscriptions will be created with the two_phase option disabled.  "
>                               "Prepared transactions will be replicated at COMMIT PREPARED.");
>     }
>
> I think this code needs to be updated as well.
>

Fixed the given comment. The attached patch contains the required changes.

Thanks and regards,
Shubham Khanna.

Commits

  1. Add two-phase option in pg_createsubscriber.