Need Force flag for pg_drop_replication_slot()

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Need Force flag for pg_drop_replication_slot()
Date: 2015-05-29 17:15:56
Message-ID: 55689ECC.9030300@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hackers,

pg_drop_replication_slot() can be a time-critical function when the
master is running out of disk space because the replica is falling
behind. So I was a little startled by this:

cio=# select
pg_drop_replication_slot('bdr_24577_6147720645156311471_1_25383__');
ERROR: replication slot "bdr_24577_6147720645156311471_1_25383__" is
already active

You have to first terminate the replication connection before you can
delete the slot ... and do it fast enough that the replica doesn't
reconnect before you drop the slot.

While I'm just doing this during testing, it could be a critical fail in
production. I think the simplest way to resolve this would be to add a
boolean flag to pg_drop_replication_slot(), which would terminate the
replication connection and delete the slot as a single operation.

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2015-05-29 17:37:40 pgindent vs emacs
Previous Message Tom Lane 2015-05-29 17:14:18 Re: fsync-pgdata-on-recovery tries to write to more files than previously