• Fujii Masao's avatar
    Prevent logical rep workers with removed subscriptions from starting. · 4eafdcc2
    Fujii Masao authored
    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
    4eafdcc2
lwlocknames.txt 1.47 KB