From: Zhijie Hou <houzhijie22@gmail.com>
To: Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
To: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Cc: amit.kapila16@gmail.com <amit.kapila16@gmail.com>
Subject: Re: Avoid resetting subscription two_phase state to pending when already enabled
Date: Thu, 29 Oct 2026 15:37:15 +0800
Message-ID: <fa4d521f-0413-4bbf-bded-0b6e47258b95@gmail.com> (raw)
In-Reply-To: <OS7PR01MB1831790CB0F0815384AABD836F56E2@OS7PR01MB18317.jpnprd01.prod.outlook.com>
References: <8e85abdf-738b-4578-ac42-4dc8eaa061dd@gmail.com>
<OS7PR01MB1831790CB0F0815384AABD836F56E2@OS7PR01MB18317.jpnprd01.prod.outlook.com>
Hi,
On Thu, Oct 29, 2026 at 03:29 PM "Hayato Kuroda (Fujitsu)" wrote:
>> While reviewing another logical replication thread, I noticed an issue
>> with altering a subscription's two_phase option.
>
> Good catch.
>
>> I think we can fix this by not resetting subtwophasestate to PENDING
>> when two_phase is already in the ENABLED state, as shown in the attached
>> patch.
>
> +1 the fix, but I have a quick confirmation.
>
> Assuming that twophasestate is 'e' and the user runs ALTER SUBSCRIPTION SET
> (two_phase = on). In this case all attributes are retained as-is but update_tuple
> is set to true anyway - CatalogTupleUpdate() would update the tuple with the
> completely the same tuple.
>
> But I feel it's acceptable because 1) it rarely happens,
> 2) conflict_log_destination option has the same issue, and 3) fixing it may
> need wider changes, like setting update_tuple in the if-statement, thought?
Right. This is the same as all (or most) subscription options and even
other object options like publication options have the same behavior,
since we don't compare the new value with the old one in most cases. So
I think that's an independent topic.
--
Best Regards,
Zhijie Hou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: houzhijie22@gmail.com, kuroda.hayato@fujitsu.com, amit.kapila16@gmail.com
Subject: Re: Avoid resetting subscription two_phase state to pending when already enabled
In-Reply-To: <fa4d521f-0413-4bbf-bded-0b6e47258b95@gmail.com>
References: <8e85abdf-738b-4578-ac42-4dc8eaa061dd@gmail.com> <OS7PR01MB1831790CB0F0815384AABD836F56E2@OS7PR01MB18317.jpnprd01.prod.outlook.com> <fa4d521f-0413-4bbf-bded-0b6e47258b95@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox