]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Prevent logical rep workers with removed subscriptions from starting.
authorFujii Masao <fujii@postgresql.org>
Wed, 8 Mar 2017 16:44:23 +0000 (01:44 +0900)
committerFujii Masao <fujii@postgresql.org>
Wed, 8 Mar 2017 16:44:23 +0000 (01:44 +0900)
commit4eafdcc27608dfb8a3afa3155d6ae07f66179782
tree9e78ad9c8e39bd42f82ff2ae5149b10189229ef8
parenta9f66f92533b2bfd7abf289219152091b7697e87
Prevent logical rep workers with removed subscriptions from starting.

Any logical rep workers must have their subscription entries in
pg_subscription. To ensure this, we need to prevent the launcher
from starting new worker corresponding to the subscription that
DROP SUBSCRIPTION command is removing. To implement this,
previously LogicalRepLauncherLock was introduced and held until
the end of transaction running DROP SUBSCRIPTION. But using
LWLock for that purpose was not valid.

Instead, this commit changes DROP SUBSCRIPTION so that it takes
AccessExclusiveLock on pg_subscription, in order to ensure that
the launcher cannot see any subscriptions being removed. Also this
commit gets rid of LogicalRepLauncherLock.

Patch by me, reviewed by Petr Jelinek

Discussion: https://www.postgresql.org/message-id/CAHGQGwHPi8ky-yANFfe0sgmhKtsYcQLTnKx07bW9S7-Rn1746w@mail.gmail.com
src/backend/commands/subscriptioncmds.c
src/backend/replication/logical/launcher.c
src/backend/storage/lmgr/lwlocknames.txt