Skip to content
Snippets Groups Projects
Commit 65df150a authored by Peter Eisentraut's avatar Peter Eisentraut
Browse files

Close replication connection when slot creation errors

From: Petr Jelinek <pjmodos@pjmodos.net>
parent aebeb479
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment