Re: [HACKERS] Create replication slot in pg_basebackup if requestedand not yet present - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [HACKERS] Create replication slot in pg_basebackup if requestedand not yet present
Date
Msg-id CAB7nPqRr7BCHFrEhRiqvFzOFrqYpyRtiVV13Bi5f9-YiWAQhMA@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Create replication slot in pg_basebackup if requestedand not yet present  (Michael Banck <michael.banck@credativ.de>)
Responses Re: [HACKERS] Create replication slot in pg_basebackup if requestedand not yet present  (Michael Banck <michael.banck@credativ.de>)
List pgsql-hackers
On Tue, Mar 21, 2017 at 1:32 AM, Michael Banck
<michael.banck@credativ.de> wrote:
> On Mon, Mar 20, 2017 at 02:42:32PM +0300, Arthur Zakirov wrote:
>> Also maybe it would be good if pg_basebackup had a way to drop created slot.
>> Although "drop slot" is not related with concept of automatically created
>> slots, it will good if user will have a way to drop slots.
>
> If you want to drop the slot after basebackup finishes you'd just use a
> temporary slot (i.e. the default), or am I understanding your use-case
> incorrectly?

Yup, agreed.

> I assumed the primary use-case for creating a non-temporary slot is to
> keep it around while the standby is active.

Indeed.
    /*
+     * Try to create a permanent replication slot if one is specified. Do
+     * not error out if the slot already exists, other errors are already
+     * reported by CreateReplicationSlot().
+     */
+    if (!stream->temp_slot && stream->replication_slot)
+    {
+        if (!CreateReplicationSlot(conn, stream->replication_slot,
NULL, true, true))
+            return false;
+    }
This could be part of an else taken from the previous if where
temp_slot is checked.

There should be some TAP tests included. And +1 for sharing the same
behavior as pg_receivewal.
-- 
Michael



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: [HACKERS] [PATCH] few fts functions for jsonb
Next
From: "Tsunakawa, Takayuki"
Date:
Subject: Re: [HACKERS] PATCH: Make pg_stop_backup() archive wait optional