Re: Wrong comment for ReplicationSlotCreate

From: Daniil Davydov <3danissimo(at)gmail(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Wrong comment for ReplicationSlotCreate
Date: 2026-01-01 16:31:17
Message-ID: CAJDiXgj-UHGy9gKeqO=sQnXq1p88ULcBgpf62_p2n2+Ay84uMw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Wed, Dec 31, 2025 at 9:32 AM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>
> You’re right that during CREATE_REPLICATION_SLOT, SnapBuildFindSnapshot() ensures we don’t miss PREPARE records for prepared transactions that exist at creation time.
>
> 1462aad2e introduced support for altering logical replication slot options, including two_phase, after the slot has been created. The commit comment says:
> ```
> Changing the 'two_phase' option for a subscription from 'true' to 'false'
> is permitted only when there are no pending prepared transactions
> corresponding to that subscription. Otherwise, the changes of already
> prepared transactions can be replicated again along with their corresponding
> commit leading to duplicate data or errors.
> ```
>
> true->false is not allowed, however false->true is permitted. So, I think the old comment is still possible today:
> ```
> * Note that enabling this option after decoding has already advanced
> * may result in missing PREPARE records for transactions that were
> * prepared before the option was enabled.
> ```
>

Hm, I still can't understand why the comment that you provided is correct.

How can we "miss PREPARE records" if slot creation requires all prepared
transactions to finish? The commit message says about risks during the
change of the parameter "on the fly". But we are dealing with slot creation.

--
Best regards,
Daniil Davydov

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2026-01-01 16:45:26 Re: Non-text mode for pg_dumpall
Previous Message Alexander Lakhin 2026-01-01 16:00:01 Re: Improving tracking/processing of buildfarm test failures