Re: Detect mismatched subscription and replication slot properties

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Zhijie Hou <houzhijie22(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Detect mismatched subscription and replication slot properties
Date: 2026-11-21 13:05:47
Message-ID: CAA4eK1JsmQZyrrF5YTGiD+jXg1a1au0C2k8mJaU8feaYref5hA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 19, 2026 at 1:35 PM Bertrand Drouvot
<bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
>
> On Thu, Nov 19, 2026 at 01:09:42PM +0530, Amit Kapila wrote:
>
> I agree that the transaction itself will not be prepared and its transactional
> changes will be rolled back. My concern is that, with parallel streaming,
> subscriber nontransactional effects may already have occurred before
> STREAM PREPARE (for example, subscriber having a default column calling nextval()).
>
> This can also happen with other apply errors, so it is not new. However, this
> particular error is predictable before decoding starts, and checking there
> avoids entering that path unnecessarily.
>
> Maybe I'm being overly concerned about this though?
>

I feel so. I think it would be good to have such checks with no or
minimal cost in terms of additional infrastructure as we expect users
to set up replication appropriately, otherwise it can fail in many
ways.

>
> > 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?
>
> I considered that too, as mentioned up-thread. My concern is that the slot could
> be changed or recreated between the query and its acquisition by START_REPLICATION.
>

Possible, but again let's try to find some way if possible to catch
differences in publisher and subscriber without additional options or
a totally new infrastructure, otherwise, we can rely on the
documentation as we do now. OTOH, if we see user complaints in this or
related differences between pub-sub configuration misbehaving then we
can try to build something better to catch the differences.

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2026-11-21 13:40:15 Re: Stop masking visibility information during WAL consistency checking
Previous Message Amit Kapila 2026-11-21 12:55:39 Re: Add a hook for handling logical decoding messages on subscribers.