On Sat, Nov 21, 2026 at 06:35:47PM +0530, Amit Kapila wrote:
> On Thu, Nov 19, 2026 at 1:35 PM Bertrand Drouvot
> <[email protected]> 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.

Fair enough. For two_phase, Hou-san's approach seems to fit that (did not look 
in
details yet).

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

For failover, querying pg_replication_slots just before START_REPLICATION and
issuing a WARNING on mismatch looks like the right approach then. The race 
window
should be small, but since the check is not atomic, a WARNING seems more 
appropriate
than an ERROR.

The documentation would still require the values to match.

What do you think?

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com


Reply via email to