Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-09-27 Thread Michael Banck
Hi, Am Mittwoch, den 27.09.2017, 10:10 -0400 schrieb Peter Eisentraut: > On 9/11/17 03:11, Michael Banck wrote: > > So my patch only moves the slot creation slightly further forward, > > AFAICT. > > I have committed this patch, along with some associated cleanup. Thanks! > > AIUI, wal streaming

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-09-27 Thread Peter Eisentraut
On 9/11/17 03:11, Michael Banck wrote: > So my patch only moves the slot creation slightly further forward, > AFAICT. I have committed this patch, along with some associated cleanup. > AIUI, wal streaming always begins at last checkpoint and from my tests > the restart_lsn of the created replicat

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-09-19 Thread Jeff Janes
On Thu, Sep 14, 2017 at 8:23 AM, Peter Eisentraut < peter.eisentr...@2ndquadrant.com> wrote: > On 9/12/17 16:39, Michael Banck wrote: > > We could split up the logic here and create the optional physical > > replication slot in the main connection and the temporary one in the WAL > > streamer conn

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-09-14 Thread Peter Eisentraut
On 9/12/17 16:39, Michael Banck wrote: > We could split up the logic here and create the optional physical > replication slot in the main connection and the temporary one in the WAL > streamer connection, but this would keep any fragility around for > (likely more frequently used) temporary replica

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-09-12 Thread Michael Banck
Hi, Am Dienstag, den 12.09.2017, 08:53 -0400 schrieb Peter Eisentraut: > On 9/11/17 03:11, Michael Banck wrote: > > > Is there a race condition here? The slot is created after the checkpoint > > > is completed. But you have to start streaming from the LSN where the > > > checkpoint started, so s

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-09-12 Thread Peter Eisentraut
On 9/11/17 03:11, Michael Banck wrote: >> Is there a race condition here? The slot is created after the checkpoint >> is completed. But you have to start streaming from the LSN where the >> checkpoint started, so shouldn't the slot be created before the checkpoint >> is started? > > So my patch

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-09-11 Thread Michael Banck
Hi, On Fri, Sep 08, 2017 at 08:41:56AM +0200, Michael Banck wrote: > Am Mittwoch, den 06.09.2017, 12:22 -0400 schrieb Peter Eisentraut: > > On 8/18/17 05:28, Michael Banck wrote: > > > > > Rebased, squashed and slighly edited version attached. I've added this > > > > > to the 2017-07 commitfest n

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-09-11 Thread Michael Banck
Hi, On Fri, Sep 08, 2017 at 10:30:20AM -0700, Jeff Janes wrote: > On Wed, Sep 6, 2017 at 9:22 AM, Peter Eisentraut < > peter.eisentr...@2ndquadrant.com> wrote: > > > On 8/18/17 05:28, Michael Banck wrote: > > >>> Rebased, squashed and slighly edited version attached. I've added this > > >>> to th

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-09-08 Thread Jeff Janes
On Wed, Sep 6, 2017 at 9:22 AM, Peter Eisentraut < peter.eisentr...@2ndquadrant.com> wrote: > On 8/18/17 05:28, Michael Banck wrote: > >>> Rebased, squashed and slighly edited version attached. I've added this > >>> to the 2017-07 commitfest now as well: > >>> > >>> https://commitfest.postgresql.o

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-09-07 Thread Michael Banck
Hi, Am Mittwoch, den 06.09.2017, 12:22 -0400 schrieb Peter Eisentraut: > On 8/18/17 05:28, Michael Banck wrote: > > > > Rebased, squashed and slighly edited version attached. I've added this > > > > to the 2017-07 commitfest now as well: > > > > > > > > https://commitfest.postgresql.org/14/1112/

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-09-07 Thread Michael Banck
Hi, not directly related to the topic, but: On Tue, Mar 21, 2017 at 03:34:00PM -0400, Robert Haas wrote: > For example, somebody creates a replica using the new super-easy > method, and then blows it away without dropping the slot from the > master, Just a thought, but maybe there should be som

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-09-06 Thread Peter Eisentraut
On 8/18/17 05:28, Michael Banck wrote: >>> Rebased, squashed and slighly edited version attached. I've added this >>> to the 2017-07 commitfest now as well: >>> >>> https://commitfest.postgresql.org/14/1112/ >> Can you rebase this past some conflicting changes? > Thanks for letting me know, PFA a r

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-08-18 Thread Michael Banck
Hi, On Tue, Aug 15, 2017 at 02:14:58PM -0700, Jeff Janes wrote: > On Sun, Apr 9, 2017 at 4:22 AM, Michael Banck > wrote: > > Rebased, squashed and slighly edited version attached. I've added this > > to the 2017-07 commitfest now as well: > > > > https://commitfest.postgresql.org/14/1112/ > > Ca

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-08-15 Thread Jeff Janes
On Sun, Apr 9, 2017 at 4:22 AM, Michael Banck wrote: > Hi, > > Am Freitag, den 24.03.2017, 19:32 +0100 schrieb Michael Banck: > > On Thu, Mar 23, 2017 at 12:41:54PM +0100, Magnus Hagander wrote: > > > On Tue, Mar 21, 2017 at 8:34 PM, Robert Haas > wrote: > > > > So I tend to think that there sho

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-04-09 Thread Michael Banck
Hi, Am Freitag, den 24.03.2017, 19:32 +0100 schrieb Michael Banck: > On Thu, Mar 23, 2017 at 12:41:54PM +0100, Magnus Hagander wrote: > > On Tue, Mar 21, 2017 at 8:34 PM, Robert Haas wrote: > > > So I tend to think that there should always be some explicit user > > > action to cause the creation

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-03-24 Thread Michael Banck
Hi, On Thu, Mar 23, 2017 at 12:41:54PM +0100, Magnus Hagander wrote: > On Tue, Mar 21, 2017 at 8:34 PM, Robert Haas wrote: > > So I tend to think that there should always be some explicit user > > action to cause the creation of a slot, like --create-slot-if-needed > > or --create-slot=name. Tha

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-03-23 Thread Magnus Hagander
On Tue, Mar 21, 2017 at 8:34 PM, Robert Haas wrote: > On Sun, Mar 19, 2017 at 12:01 PM, Magnus Hagander > wrote: > > I think maybe we should output a message when the slot is created, at > least > > in verbose mode, to make sure people realize that happened. Does that > seem > > reasonable? > >

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-03-22 Thread Kyotaro HORIGUCHI
Hello, I favor this feature. At Wed, 22 Mar 2017 00:18:19 -0400, Peter Eisentraut wrote in <1f5daba9-773d-9281-5608-37f049025...@2ndquadrant.com> > On 3/21/17 15:34, Robert Haas wrote: > > So I tend to think that there should always be some explicit user > > action to cause the creation of a sl

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-03-21 Thread Peter Eisentraut
On 3/21/17 15:34, Robert Haas wrote: > So I tend to think that there should always be some explicit user > action to cause the creation of a slot, like --create-slot-if-needed > or --create-slot=name. That still won't prevent careless use of that > option but it's less dangerous than assuming that

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-03-21 Thread Michael Banck
Hi, Am Mittwoch, den 22.03.2017, 00:40 +0100 schrieb Michael Banck: > I guess if we decide (physical) slots should not be created implicitly, > then using the same UI as pg_receivewal makes sense for the sake of > consistency, i.e. "--slot=name --create-slot [--if-not-exists]". That is > rather ve

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-03-21 Thread Michael Banck
Am Dienstag, den 21.03.2017, 15:34 -0400 schrieb Robert Haas: > On Sun, Mar 19, 2017 at 12:01 PM, Magnus Hagander wrote: > > I think maybe we should output a message when the slot is created, at least > > in verbose mode, to make sure people realize that happened. Does that seem > > reasonable? >

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-03-21 Thread Robert Haas
On Sun, Mar 19, 2017 at 12:01 PM, Magnus Hagander wrote: > I think maybe we should output a message when the slot is created, at least > in verbose mode, to make sure people realize that happened. Does that seem > reasonable? Slots are great until you leave one lying around by accident. I'm afra

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-03-21 Thread Michael Banck
Am Dienstag, den 21.03.2017, 12:52 +0100 schrieb Michael Banck: > New patches attached. On second though, there was a superfluous whitespace change in t/010_pg_basebackup.pl, and I've moved the check-for-hex regex fix to the second patch as it's cosmetic and not related to changing the --slot crea

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-03-21 Thread Michael Banck
Hi, Am Dienstag, den 21.03.2017, 11:03 +0900 schrieb Michael Paquier: > On Tue, Mar 21, 2017 at 1:32 AM, Michael Banck > wrote: > /* > + * Try to create a permanent replication slot if one is specified. Do > + * not error out if the slot already exists, other errors are already > +

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-03-20 Thread Michael Paquier
On Tue, Mar 21, 2017 at 1:32 AM, Michael Banck 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 goo

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-03-20 Thread Michael Banck
Hi, 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 t

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-03-20 Thread Arthur Zakirov
Hello, On 19.03.2017 21:45, Michael Banck wrote: So the patch I sent earlier creates the slot in ReceiveXlogStream() in receivewal.c, as that's where the temp slot gets created as well, but now I wonder whether that is maybe not the best place, as pg_receivewal also calls that function. The oth

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-03-19 Thread Michael Banck
Hi, On Sun, Mar 19, 2017 at 05:01:23PM +0100, Magnus Hagander wrote: > On Sun, Mar 19, 2017 at 11:21 AM, Michael Banck > wrote: > > So I propose the attached tiny patch to just create the slot (if it does > > not exist already) in pg_basebackup, somewhat similar to what > > pg_receivewal does, al

Re: [HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-03-19 Thread Magnus Hagander
On Sun, Mar 19, 2017 at 11:21 AM, Michael Banck wrote: > Hi, > > with the default configuration improvements so far for 10, it seems to > be very easy to setup streaming replication (at least locally): > > $ initdb --pgdata=data1 > $ pg_ctl --pgdata=data1 start > $ pg_basebackup --pgdata=data2 --

[HACKERS] Create replication slot in pg_basebackup if requested and not yet present

2017-03-19 Thread Michael Banck
Hi, with the default configuration improvements so far for 10, it seems to be very easy to setup streaming replication (at least locally): $ initdb --pgdata=data1 $ pg_ctl --pgdata=data1 start $ pg_basebackup --pgdata=data2 --write-recovery-conf $ sed -i -e 's/^#port.=.5432/port = 5433/' \ > -e '