Re: Orphaned records in pg_replication_origin_status after subscription drop

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>, Amit Kapila <amit.kapila16@gmail.com>, Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-12-22T23:21:39Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Update comments to reflect changes in 8e0d32a4a1.

  2. Fix orphaned origin in shared memory after DROP SUBSCRIPTION

On Mon, Dec 22, 2025 at 01:22:38PM -0800, Masahiko Sawada wrote:
> Thank you for making the patch! The patch looks good to me.

Creating the origin at the end of the same transaction that sets the
state to SUBREL_STATE_DATASYNC seems sensible here.  I'll spend a
couple of extra hours playing with all that across all the branches,
see if I can wrap it.  This includes some more error injection to
cross-check the state of all these transactions with the states in
the catalogs while we drop the subscription.

The test addition is interesting, nice.  I didn't notice that it would
be possible to use this trick in 004_sync..

Also, I have double-checked the names of the folks who have reported
the bug, giving the following list for the commit logs (in case I
don't finish this stuff, feel free to use that):
Daisuke Higuchi <higudai@amazon.com>
Tenglong Gu <brucegu@amazon.com>
--
Michael