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

From: Shubham Khanna <khannashubham1197(at)gmail(dot)com>
To: Ajin Cherian <itsajin(at)gmail(dot)com>
Cc: Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Adding a '--two-phase' option to 'pg_createsubscriber' utility.
Date: 2025-01-16 11:16:06
Message-ID: CAHv8Rj+Zqc9qVEaJDW03Cux_S_CMHWNM056qqJi5+z9vSYgtew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 15, 2025 at 3:54 PM Ajin Cherian <itsajin(at)gmail(dot)com> wrote:
>
>
>
> On Wed, Jan 15, 2025 at 5:33 PM Shubham Khanna <khannashubham1197(at)gmail(dot)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.

Attachment Content-Type Size
v11-0001-Add-support-for-two-phase-commit-in-pg_createsub.patch application/octet-stream 14.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Shubham Khanna 2025-01-16 11:21:00 Re: Adding a '--two-phase' option to 'pg_createsubscriber' utility.
Previous Message Shlok Kyal 2025-01-16 11:06:44 Re: Log a warning in pg_createsubscriber for max_slot_wal_keep_size