Thread: [COMMITTERS] pgsql: Prevent logical rep workers with removed subscriptions fromstar
[COMMITTERS] pgsql: Prevent logical rep workers with removed subscriptions fromstar
From
Fujii Masao
Date:
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 Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/4eafdcc27608dfb8a3afa3155d6ae07f66179782 Modified Files -------------- src/backend/commands/subscriptioncmds.c | 12 ++++++------ src/backend/replication/logical/launcher.c | 10 ---------- src/backend/storage/lmgr/lwlocknames.txt | 3 +-- 3 files changed, 7 insertions(+), 18 deletions(-)