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

Commit77d2197

Browse files
committed
Fix connection leak in DROP SUBSCRIPTION command, take 2.
Commit898a792 fixed the connectionleak issue, but it was an unreliable way of bugfix. This bugfix wasassuming that walrcv_command() subroutine cannot throw an error,but it's untenable assumption. For example, if it will be changedso that an error is thrown, connection leak issue will happen again.This patch ensures that the connection is closed even whenwalrcv_command() subroutine throws an error.Patch by me, reviewed by Petr Jelinek and Michael PaquierDiscussion:https://www.postgresql.org/message-id/2058.1487704345@sss.pgh.pa.us
1 parent044d9ef commit77d2197

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

‎src/backend/commands/subscriptioncmds.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -565,19 +565,25 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
565565
"drop the replication slot \"%s\"",slotname),
566566
errdetail("The error was: %s",err)));
567567

568-
if (!walrcv_command(wrconn,cmd.data,&err))
568+
PG_TRY();
569+
{
570+
if (!walrcv_command(wrconn,cmd.data,&err))
571+
ereport(ERROR,
572+
(errmsg("could not drop the replication slot \"%s\" on publisher",
573+
slotname),
574+
errdetail("The error was: %s",err)));
575+
else
576+
ereport(NOTICE,
577+
(errmsg("dropped replication slot \"%s\" on publisher",
578+
slotname)));
579+
}
580+
PG_CATCH();
569581
{
570582
/* Close the connection in case of failure */
571583
walrcv_disconnect(wrconn);
572-
ereport(ERROR,
573-
(errmsg("could not drop the replication slot \"%s\" on publisher",
574-
slotname),
575-
errdetail("The error was: %s",err)));
584+
PG_RE_THROW();
576585
}
577-
else
578-
ereport(NOTICE,
579-
(errmsg("dropped replication slot \"%s\" on publisher",
580-
slotname)));
586+
PG_END_TRY();
581587

582588
walrcv_disconnect(wrconn);
583589

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp