RE: Avoid resetting subscription two_phase state to pending when already enabled

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'Zhijie Hou' <houzhijie22(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: "amit(dot)kapila16(at)gmail(dot)com" <amit(dot)kapila16(at)gmail(dot)com>
Subject: RE: Avoid resetting subscription two_phase state to pending when already enabled
Date: 2026-10-29 07:29:52
Message-ID: OS7PR01MB1831790CB0F0815384AABD836F56E2@OS7PR01MB18317.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

> 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?

Best regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-10-29 07:30:07 Re: tablecmds: Deadlock caused by Attach Partition
Previous Message Takeshi Ideriha 2026-10-29 07:20:46 Re: [PATCH] pgcrypto: Fix sha-crypt rounds= values that do not fit in int (BUG #19743)