Hi, ALTER SUBSCRIPTION ... WITH (SLOT NAME = foo) will make the worker dies on error about unexpected subscription changed. It's my oversight in the original logical replication patch-set. Attached patch fixes it to behave same way as other changes to subscription options.
-- Petr Jelinek http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
>From aaa54e5a608987449542da65fa029afa73d4373b Mon Sep 17 00:00:00 2001 From: Petr Jelinek <pjmo...@pjmodos.net> Date: Tue, 21 Mar 2017 22:04:57 +0100 Subject: [PATCH] Handle change of slotname in logical replication apply --- src/backend/replication/logical/worker.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c index c2ccab7..fc01cd3 100644 --- a/src/backend/replication/logical/worker.c +++ b/src/backend/replication/logical/worker.c @@ -1352,6 +1352,21 @@ reread_subscription(void) } /* + * We need to make new connection to new slot if slot name has changed + * so exit here as well if that's the case. + */ + if (strcmp(newsub->slotname, MySubscription->slotname) != 0) + { + ereport(LOG, + (errmsg("logical replication worker for subscription \"%s\" will " + "restart because the replication slot name was changed", + MySubscription->name))); + + walrcv_disconnect(wrconn); + proc_exit(0); + } + + /* * Exit if publication list was changed. The launcher will start * new worker. */ @@ -1383,8 +1398,7 @@ reread_subscription(void) } /* Check for other changes that should never happen too. */ - if (newsub->dbid != MySubscription->dbid || - strcmp(newsub->slotname, MySubscription->slotname) != 0) + if (newsub->dbid != MySubscription->dbid) { elog(ERROR, "subscription %u changed unexpectedly", MyLogicalRepWorker->subid); -- 2.7.4
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers