暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

逻辑复制环境删除订阅报错 replication slot does not exist

瀚高PG实验室 2023-03-11
547

目录

环境

症状

问题原因

解决方案


环境

系统平台:N/A

版本:4.5.7

症状

删除订阅时报错:

    highgo=# drop subscription test2_sub ;       


    ERROR: could not drop replication slot "test2_sub" on publisher: ERROR: replication slot "test2_sub" does not exist

    (左右滑动查看完整内容)


    问题原因

    当删除订阅时,DROP SUBSCRIPTION操作将连接到逻辑复制的主库上清理绑定的复制槽,如果相关复制槽未被发现,则执行DROP SUBSCRIPTION命令时将会报错。

    这种情况说明该订阅使用到的复制槽已被各种原因删除。

    解决方案

    需要解除复制槽与订阅的绑定关系。

      highgo=# alter subscription test2_sub set (slot_name =none);


      ALTER SUBSCRIPTION

      (左右滑动查看完整内容)

      如果订阅状态为enable,需要先disable,然后再解除绑定:

        highgo=#  alter subscription test2_sub disable;


        ALTER SUBSCRIPTION


        highgo=# alter subscription test2_sub set (slot_name =none);


        ALTER SUBSCRIPTION

        (左右滑动查看完整内容)

        否则会报错:

          highgo=# alter subscription test2_sub set (slot_name =none);


          ERROR: cannot set slot_name = NONE for enabled subscription

          (左右滑动查看完整内容)


          文章转载自瀚高PG实验室,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

          评论