Need Force flag for pg_drop_replication_slot() - Mailing list pgsql-hackers

From Josh Berkus
Subject Need Force flag for pg_drop_replication_slot()
Date
Msg-id 55689ECC.9030300@agliodbs.com
Whole thread Raw
Responses Re: Need Force flag for pg_drop_replication_slot()  (Andres Freund <andres@anarazel.de>)
Re: Need Force flag for pg_drop_replication_slot()  (Simon Riggs <simon@2ndQuadrant.com>)
Re: Need Force flag for pg_drop_replication_slot()  (Simon Riggs <simon@2ndQuadrant.com>)
List 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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: fsync-pgdata-on-recovery tries to write to more files than previously
Next
From: Andrew Dunstan
Date:
Subject: pgindent vs emacs