Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit65df150

Browse files
committed
Close replication connection when slot creation errors
From: Petr Jelinek <pjmodos@pjmodos.net>
1 parentaebeb47 commit65df150

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)

[8]ページ先頭

©2009-2025 Movatter.jp