On Thu, Nov 19, 2026 at 12:02 PM Zhijie Hou <[email protected]> wrote:
>
> On Wed, Nov18, 2026 at 10:15 PM Bertrand Drouvot wrote:
> >
> > On Mon, Nov 16, 2026 at 03:46:25PM +0530, Amit Kapila wrote:
> > > On Tue, Nov 10, 2026 at 7:44 PM Bertrand Drouvot
> > > > For failover, the value should match exactly.
> > > >
> > > > For two_phase, the expected value depends on subtwophasestate:
> > > >
> > > > • DISABLED: the slot must have two_phase = false.
> > > > • PENDING, before the tables are ready: it must remain false.
> > > > • PENDING, once the tables are ready: either value can be accepted 
> > > > before enabling
> > > > it and recording the state as ENABLED. This also makes the
> > > > transition safe if the worker previously exited between those two
> > > > operations.
> > > > • ENABLED: the slot must have two_phase = true.
> > > >
> > >
> > > Instead of PENDING state checks, how about checking mismatch in
> > > begin_prepared kind of functions whether the subscription has
> > > reached ENABLED state? I am asking this because if the slot is
> > > initially created with two_phase = true and the subscription is in
> > > pending state then the apply worker will start receiving prepared
> > > transactions and will lead to problems described under "TWO_PHASE
> > > TRANSACTIONS" in worker.c.
> >
> > Thanks for looking at it!
> >
> > I think that could be too late. With parallel streaming, a parallel
> > apply worker may already have executed the transaction's changes.
>
>
> IIUC, it wouldn't be too late. Even if the changes are already being
> executed, the transaction won't be prepared if we catch the mismatch in
> apply_handle_prepare (and related functions).
>

Right, I also thought so. Also, I don't like adding new options for
detecting these ERROR cases, the main idea is that such differences
should not lead to inconsistencies. BTW, I don't know what to do for a
failover property if we go with this idea? Do we need to perform a SQL
query to get the required slot properties and then compare it with
current subscription properties?


-- 
With Regards,
Amit Kapila.


Reply via email to