public inbox for [email protected]  
help / color / mirror / Atom feed
From: shveta malik <[email protected]>
To: Fujii Masao <[email protected]>
Cc: SATYANARAYANA NARLAPURAM <[email protected]>
Cc: vignesh C <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Cc: shveta malik <[email protected]>
Subject: Re: [PATCH] Release replication slot on error in SQL-callable slot functions
Date: Wed, 27 May 2026 16:29:59 +0530
Message-ID: <CAJpy0uB3sb2wfXaoYd8XnK53GcpTLW6BJLJve_K6JdNy8-dpgg@mail.gmail.com> (raw)
In-Reply-To: <CAHGQGwEoENMBTu0=f2h5_GFfTc-dGEo+_CfS0jinPwTX2AcyYA@mail.gmail.com>
References: <CAHg+QDeuf9tCq3ce=kgFMJP0m=PZC+wi6B=yS+7V0vNXjLS31w@mail.gmail.com>
	<CAHGQGwFZaWj8DctXuhWQZwSqi631=NKzQJyDV4yqT1Qapt8MFQ@mail.gmail.com>
	<CALDaNm1Jjun=by60V-4EpLZe4pAKy0qVZ7ptyHGVCuDyKfo2xQ@mail.gmail.com>
	<CAHg+QDcu2x0mjkBSqRxP_8EQ6UmpuX_jMgdKLDkAL1=N6wzZCQ@mail.gmail.com>
	<CAJpy0uCmW_NUZN8mw26onvfoFzH_oMrFSKhLUhz896nDgf8c7Q@mail.gmail.com>
	<CAHg+QDcf_9prAX=TaSO3UUiCLVD53bEw-KLqzAEXi+ud7h+Z4w@mail.gmail.com>
	<CAJpy0uBShUF_xm0=BVWivpWHt-4zs__k_3wL1RRjpi0Av8nsog@mail.gmail.com>
	<CAHg+QDf5PVyFgesBNs1GvOnuk_khoXifo96A7QW1EJ8zhhBxyw@mail.gmail.com>
	<CAJpy0uCCqFLY7pu0RQVcS9fRr0FimFMuHPsMBQ-KzEGX3BEGPA@mail.gmail.com>
	<CAJpy0uDHMvpUAdwXA3X7ugmO8S7kry-ZtrKUcugpX3WWp8hykw@mail.gmail.com>
	<CAHg+QDdEGGQrmQXwH0_Y+DRe_tx5jxv9K+7vpCnooQn2_6QykA@mail.gmail.com>
	<CAJpy0uBo-OuzyZZ=LY8L48Udt8=1Mffh2rrpXaTbKK_F9sJx7A@mail.gmail.com>
	<CAHg+QDeKC=_31Fvs2pOVkJCdkpNuoJmLmXV5hOApStpODYWsXw@mail.gmail.com>
	<CAHGQGwEoENMBTu0=f2h5_GFfTc-dGEo+_CfS0jinPwTX2AcyYA@mail.gmail.com>

On Wed, May 27, 2026 at 1:42 PM Fujii Masao <[email protected]> wrote:
>
> On Wed, May 27, 2026 at 1:31 PM SATYANARAYANA NARLAPURAM
> <[email protected]> wrote:
> > Thank you for the changes and review.
>
> When I applied the v4 patch together with Shveta's diff patch and
> ran the regression tests, the tests failed.

That is because my top-up patch lacks slot.out changes, I wanted Satya
to first confirm if the changes are acceptable to him. Attached
another top-up patch for test-output correction.

> Could pg_create_physical_replication_slot() still have the same issue
> if it throws an error after ReplicationSlotCreate() and that error is
> caught by a PL/pgSQL EXCEPTION block?
>
> Also, do maybe pg_copy_physical_replication_slot(), pg_drop_replication_slot(),
> and ALTER_REPLICATION_SLOT potentially have the same issue as well?
>

pg_copy_physical_replication_slot() should not have it as the common
'copy_replication_slot' is already fixed in the patch.  I will review
the others.

thanks
Shveta

From fccb0438213a82af582f5d3a11c09a0060999565 Mon Sep 17 00:00:00 2001
From: Shveta Malik <[email protected]>
Date: Wed, 27 May 2026 16:21:02 +0530
Subject: [PATCH] test result changes

---
 contrib/test_decoding/expected/slot.out | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/contrib/test_decoding/expected/slot.out b/contrib/test_decoding/expected/slot.out
index f4cb234028b..3a04d2fbe67 100644
--- a/contrib/test_decoding/expected/slot.out
+++ b/contrib/test_decoding/expected/slot.out
@@ -481,6 +481,7 @@ EXCEPTION WHEN OTHERS THEN
 END;
 $$;
 NOTICE:  caught: could not access file "nonexistent_plugin_xyz": No such file or directory
+-- the concerned slot must not exist (it was dropped on error)
 SELECT count(*) = 0 AS slot_was_dropped FROM pg_replication_slots
     WHERE slot_name = 'regression_slot_error';
  slot_was_dropped 
@@ -488,7 +489,8 @@ SELECT count(*) = 0 AS slot_was_dropped FROM pg_replication_slots
  t
 (1 row)
 
-SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot_t3', 'test_decoding', true);
+-- the session is still usable
+SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot_t3', 'test_decoding', false);
  ?column? 
 ----------
  init
@@ -510,7 +512,7 @@ EXCEPTION WHEN OTHERS THEN
 END;
 $$;
 NOTICE:  caught expected error
--- the session is still healthy
+-- the session is still usable
 SELECT slot_name FROM pg_replication_slot_advance('regression_slot_t3', pg_current_wal_lsn());
      slot_name      
 --------------------
-- 
2.34.1



Attachments:

  [text/plain] 0001-test-result-changes.patch.txt (1.5K, 2-0001-test-result-changes.patch.txt)
  download | inline diff:
From fccb0438213a82af582f5d3a11c09a0060999565 Mon Sep 17 00:00:00 2001
From: Shveta Malik <[email protected]>
Date: Wed, 27 May 2026 16:21:02 +0530
Subject: [PATCH] test result changes

---
 contrib/test_decoding/expected/slot.out | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/contrib/test_decoding/expected/slot.out b/contrib/test_decoding/expected/slot.out
index f4cb234028b..3a04d2fbe67 100644
--- a/contrib/test_decoding/expected/slot.out
+++ b/contrib/test_decoding/expected/slot.out
@@ -481,6 +481,7 @@ EXCEPTION WHEN OTHERS THEN
 END;
 $$;
 NOTICE:  caught: could not access file "nonexistent_plugin_xyz": No such file or directory
+-- the concerned slot must not exist (it was dropped on error)
 SELECT count(*) = 0 AS slot_was_dropped FROM pg_replication_slots
     WHERE slot_name = 'regression_slot_error';
  slot_was_dropped 
@@ -488,7 +489,8 @@ SELECT count(*) = 0 AS slot_was_dropped FROM pg_replication_slots
  t
 (1 row)
 
-SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot_t3', 'test_decoding', true);
+-- the session is still usable
+SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot_t3', 'test_decoding', false);
  ?column? 
 ----------
  init
@@ -510,7 +512,7 @@ EXCEPTION WHEN OTHERS THEN
 END;
 $$;
 NOTICE:  caught expected error
--- the session is still healthy
+-- the session is still usable
 SELECT slot_name FROM pg_replication_slot_advance('regression_slot_t3', pg_current_wal_lsn());
      slot_name      
 --------------------
-- 
2.34.1



reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: [PATCH] Release replication slot on error in SQL-callable slot functions
  In-Reply-To: <CAJpy0uB3sb2wfXaoYd8XnK53GcpTLW6BJLJve_K6JdNy8-dpgg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox