IF [NOT] EXISTS for replication slots

Started by Michael Paquieralmost 9 years ago4 messages
#1Michael Paquier
michael.paquier@gmail.com

Hi all,

Lately I have bumped into a case where it would have been useful to
make the difference between a failure because of a slot already
dropped and an internal failure of Postgres. Is there any interest for
support of IE and INE for CREATE and DROP_REPLICATION_SLOT?
My use case involved only the SQL-callable interface, but I would
think that it is useful to make this difference as well with the
replication protocol. For the function we could just add a boolean
argument to control the switch, and for the replication commands a
dedicated keyword.

Any thoughts?
--
Michael

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#2Petr Jelinek
petr.jelinek@2ndquadrant.com
In reply to: Michael Paquier (#1)
Re: IF [NOT] EXISTS for replication slots

On 06/02/17 05:15, Michael Paquier wrote:

Hi all,

Lately I have bumped into a case where it would have been useful to
make the difference between a failure because of a slot already
dropped and an internal failure of Postgres. Is there any interest for
support of IE and INE for CREATE and DROP_REPLICATION_SLOT?
My use case involved only the SQL-callable interface, but I would
think that it is useful to make this difference as well with the
replication protocol. For the function we could just add a boolean
argument to control the switch, and for the replication commands a
dedicated keyword.

Any thoughts?

My thought is, how would this handle the snapshot creation that logical
slot does when it's created?

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Michael Paquier
michael.paquier@gmail.com
In reply to: Petr Jelinek (#2)
Re: IF [NOT] EXISTS for replication slots

On Tue, Feb 7, 2017 at 2:07 AM, Petr Jelinek
<petr.jelinek@2ndquadrant.com> wrote:

On 06/02/17 05:15, Michael Paquier wrote:

Hi all,

Lately I have bumped into a case where it would have been useful to
make the difference between a failure because of a slot already
dropped and an internal failure of Postgres. Is there any interest for
support of IE and INE for CREATE and DROP_REPLICATION_SLOT?
My use case involved only the SQL-callable interface, but I would
think that it is useful to make this difference as well with the
replication protocol. For the function we could just add a boolean
argument to control the switch, and for the replication commands a
dedicated keyword.

Any thoughts?

My thought is, how would this handle the snapshot creation that logical
slot does when it's created?

In what is that related to IF NOT EXISTS? If the slot does not get
created you could just return NULL to the caller to let him know that
there is something already around. The use-case I have found INE
useful involved physical slots actually.
--
Michael

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Petr Jelinek
petr.jelinek@2ndquadrant.com
In reply to: Michael Paquier (#3)
Re: IF [NOT] EXISTS for replication slots

On 07/02/17 01:00, Michael Paquier wrote:

On Tue, Feb 7, 2017 at 2:07 AM, Petr Jelinek
<petr.jelinek@2ndquadrant.com> wrote:

On 06/02/17 05:15, Michael Paquier wrote:

Hi all,

Lately I have bumped into a case where it would have been useful to
make the difference between a failure because of a slot already
dropped and an internal failure of Postgres. Is there any interest for
support of IE and INE for CREATE and DROP_REPLICATION_SLOT?
My use case involved only the SQL-callable interface, but I would
think that it is useful to make this difference as well with the
replication protocol. For the function we could just add a boolean
argument to control the switch, and for the replication commands a
dedicated keyword.

Any thoughts?

My thought is, how would this handle the snapshot creation that logical
slot does when it's created?

In what is that related to IF NOT EXISTS? If the slot does not get
created you could just return NULL to the caller to let him know that
there is something already around.

Well, the current behavior and the common use-case for creating logical
slot via walsender is to get the snapshot which corresponds to LSN, the
above would break that behavior for some variants of the command which I
find rather confusing from user perspective.

The use-case I have found INE
useful involved physical slots actually.

I am sure others would find it useful for logical ones as well.

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers