Re: Logical slot creation/synchronization on a standby may deadlock with recovery conflict resolution

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Xuneng Zhou <xunengzhou(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Amit Kapila <amitkapila16(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>
Subject: Re: Logical slot creation/synchronization on a standby may deadlock with recovery conflict resolution
Date: 2026-09-24 09:28:33
Message-ID: arTtQeXjXFVcycpK@bdtpg
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Thu, Sep 24, 2026 at 03:49:35PM +0800, Xuneng Zhou wrote:
> Hi hackers,
>
> I don't see a clear solution to this potential issue, because the interface
> is a function, which means that the held snapshots cannot be popped cleanly
> since they belong to the surrounding executor.

Thanks for the report and reproducers!

Thinking out loud, I wonder if we could add a transient PGPROC state while a
backend depends on recovery replay. After deadlock_timeout, ResolveRecoveryConflictWithVirtualXIDs()
could check whether a VXID in its waitlist has that state set and, if so, use the
existing recovery conflict cancellation path.

Does that make sense to you and others? If so, I can have a look at preparing a
patch.

Regards,

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nitin Jadhav 2026-09-24 09:32:04 Expose redo start information in pg_stat_recovery
Previous Message shveta malik 2026-09-24 09:19:42 Re: Fix "unexpected logical decoding status change" error; from concurrent logical decoding activation