Skip to content

Commit 65df150

Browse files
committed
Close replication connection when slot creation errors
From: Petr Jelinek <pjmodos@pjmodos.net>
1 parent aebeb47 commit 65df150

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/backend/commands/subscriptioncmds.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,20 @@ CreateSubscription(CreateSubscriptionStmt *stmt)
301301
ereport(ERROR,
302302
(errmsg("could not connect to the publisher: %s", err)));
303303

304-
walrcv_create_slot(wrconn, slotname, false, &lsn);
305-
ereport(NOTICE,
306-
(errmsg("created replication slot \"%s\" on publisher",
307-
slotname)));
304+
PG_TRY();
305+
{
306+
walrcv_create_slot(wrconn, slotname, false, &lsn);
307+
ereport(NOTICE,
308+
(errmsg("created replication slot \"%s\" on publisher",
309+
slotname)));
310+
}
311+
PG_CATCH();
312+
{
313+
/* Close the connection in case of failure. */
314+
walrcv_disconnect(wrconn);
315+
PG_RE_THROW();
316+
}
317+
PG_END_TRY();
308318

309319
/* And we are done with the remote side. */
310320
walrcv_disconnect(wrconn);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy