mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Close replication connection when slot creation errors
From: Petr Jelinek <pjmodos@pjmodos.net>
This commit is contained in:
@ -301,10 +301,20 @@ CreateSubscription(CreateSubscriptionStmt *stmt)
|
|||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errmsg("could not connect to the publisher: %s", err)));
|
(errmsg("could not connect to the publisher: %s", err)));
|
||||||
|
|
||||||
|
PG_TRY();
|
||||||
|
{
|
||||||
walrcv_create_slot(wrconn, slotname, false, &lsn);
|
walrcv_create_slot(wrconn, slotname, false, &lsn);
|
||||||
ereport(NOTICE,
|
ereport(NOTICE,
|
||||||
(errmsg("created replication slot \"%s\" on publisher",
|
(errmsg("created replication slot \"%s\" on publisher",
|
||||||
slotname)));
|
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. */
|
/* And we are done with the remote side. */
|
||||||
walrcv_disconnect(wrconn);
|
walrcv_disconnect(wrconn);
|
||||||
|
Reference in New Issue
Block a user