mirror of
https://github.com/postgres/postgres.git
synced 2025-06-25 01:02:05 +03:00
Remove the NODROP SLOT option from DROP SUBSCRIPTION
It turned out this approach had problems, because a DROP command should not have any options other than CASCADE and RESTRICT. Instead, always attempt to drop the slot if there is one configured, but also add an ALTER SUBSCRIPTION action to set the slot to NONE. Author: Petr Jelinek <petr.jelinek@2ndquadrant.com> Reported-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/29431.1493730652@sss.pgh.pa.us
This commit is contained in:
@ -1328,6 +1328,22 @@ reread_subscription(void)
|
||||
proc_exit(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Exit if the subscription was disabled.
|
||||
* This normally should not happen as the worker gets killed
|
||||
* during ALTER SUBSCRIPTION ... DISABLE.
|
||||
*/
|
||||
if (!newsub->enabled)
|
||||
{
|
||||
ereport(LOG,
|
||||
(errmsg("logical replication worker for subscription \"%s\" will "
|
||||
"stop because the subscription was disabled",
|
||||
MySubscription->name)));
|
||||
|
||||
walrcv_disconnect(wrconn);
|
||||
proc_exit(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Exit if connection string was changed. The launcher will start
|
||||
* new worker.
|
||||
@ -1358,6 +1374,9 @@ reread_subscription(void)
|
||||
proc_exit(0);
|
||||
}
|
||||
|
||||
/* !slotname should never happen when enabled is true. */
|
||||
Assert(newsub->slotname);
|
||||
|
||||
/*
|
||||
* We need to make new connection to new slot if slot name has changed
|
||||
* so exit here as well if that's the case.
|
||||
@ -1388,22 +1407,6 @@ reread_subscription(void)
|
||||
proc_exit(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Exit if the subscription was disabled.
|
||||
* This normally should not happen as the worker gets killed
|
||||
* during ALTER SUBSCRIPTION ... DISABLE.
|
||||
*/
|
||||
if (!newsub->enabled)
|
||||
{
|
||||
ereport(LOG,
|
||||
(errmsg("logical replication worker for subscription \"%s\" will "
|
||||
"stop because the subscription was disabled",
|
||||
MySubscription->name)));
|
||||
|
||||
walrcv_disconnect(wrconn);
|
||||
proc_exit(0);
|
||||
}
|
||||
|
||||
/* Check for other changes that should never happen too. */
|
||||
if (newsub->dbid != MySubscription->dbid)
|
||||
{
|
||||
|
Reference in New Issue
Block a user