git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: aebeb47)
Close replication connection when slot creation errors
2017年1月25日 15:47:53 +0000 (10:47 -0500)
2017年1月25日 15:47:53 +0000 (10:47 -0500)
From: Petr Jelinek <pjmodos@pjmodos.net>


diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index 2b6d3225594381a1c37135b7ede1ad470eb6bca4..e0add949534ea0ccf9b48e0952e2dfd271b30e01 100644 (file)
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -301,10 +301,20 @@ CreateSubscription(CreateSubscriptionStmt *stmt)
ereport(ERROR,
(errmsg("could not connect to the publisher: %s", err)));
- walrcv_create_slot(wrconn, slotname, false, &lsn);
- ereport(NOTICE,
- (errmsg("created replication slot \"%s\" on publisher",
- slotname)));
+ PG_TRY();
+ {
+ walrcv_create_slot(wrconn, slotname, false, &lsn);
+ ereport(NOTICE,
+ (errmsg("created replication slot \"%s\" on publisher",
+ slotname)));
+ }
+ PG_CATCH();
+ {
+ /* Close the connection in case of failure. */
+ walrcv_disconnect(wrconn);
+ PG_RE_THROW();
+ }
+ PG_END_TRY();
/* And we are done with the remote side. */
walrcv_disconnect(wrconn);
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /