Re: [PATCH] Make pg_basebackup configure and start standby

Lists: pgsql-hackers
From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Subject: [PATCH] Make pg_basebackup configure and start standby
Date: 2012-07-01 11:02:17
Message-ID: 4FF02E39.6070002@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

attached is a patch that does $SUBJECT.

It's a usability enhancement, to take a backup, write
a minimalistic recovery.conf and start the streaming
standby in one go.

Comments?

Best regards,
Zoltán Böszörményi

--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
http://www.postgresql.at/

Attachment Content-Type Size
01-pg_basebackup.patch text/x-patch 6.7 KB

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: pgsql-hackers(at)postgresql(dot)org, Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Subject: Re: [PATCH] Make pg_basebackup configure and start standby
Date: 2012-07-01 15:38:13
Message-ID: CAHGQGwG_XkuK3C=P3o1KGikyF7+Bta=r+myHMG33roO66L3NJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Jul 1, 2012 at 8:02 PM, Boszormenyi Zoltan <zb(at)cybertec(dot)at> wrote:
> Hi,
>
> attached is a patch that does $SUBJECT.
>
> It's a usability enhancement, to take a backup, write
> a minimalistic recovery.conf and start the streaming
> standby in one go.
>
> Comments?

Could you add the patch to the next CommitFest?

If the backup is taken from the standby server, the standby's recovery.conf
is included in the backup. What happens in this case?

Regards,

--
Fujii Masao


From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Subject: Re: [PATCH] Make pg_basebackup configure and start standby
Date: 2012-07-01 15:42:41
Message-ID: 4FF06FF1.1060509@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

2012-07-01 17:38 keltezéssel, Fujii Masao írta:
> On Sun, Jul 1, 2012 at 8:02 PM, Boszormenyi Zoltan <zb(at)cybertec(dot)at> wrote:
>> Hi,
>>
>> attached is a patch that does $SUBJECT.
>>
>> It's a usability enhancement, to take a backup, write
>> a minimalistic recovery.conf and start the streaming
>> standby in one go.
>>
>> Comments?
> Could you add the patch to the next CommitFest?

I will.

> If the backup is taken from the standby server, the standby's recovery.conf
> is included in the backup. What happens in this case?

As documented, the command line parameters of pg_basebackup
will be used for recovery.conf. So, the new standby will replicate
the previous one. Cascading replication works since 9.2.

Best regards,
Zoltán Böszörményi

--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
http://www.postgresql.at/


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: pgsql-hackers(at)postgresql(dot)org, Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Subject: Re: [PATCH] Make pg_basebackup configure and start standby
Date: 2012-07-01 15:44:30
Message-ID: CABUevEwEma9FT1yjJa7q_ow4Ce28qfb-J+P8tSf1npKn_umOeQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Jul 1, 2012 at 1:02 PM, Boszormenyi Zoltan <zb(at)cybertec(dot)at> wrote:
> Hi,
>
> attached is a patch that does $SUBJECT.
>
> It's a usability enhancement, to take a backup, write
> a minimalistic recovery.conf and start the streaming
> standby in one go.

I like the writing of recovery.conf. In fact, I had it in my code at
one very early point and took it out in order to get a clean patch
ready :)

But I think that part is lacking in functionality: AFAICT it's
hardcoded to only handle host, port, user and password. What about
other connection parameters, likely passed to pg_basebackup through
the environment in that case? isn't that quite likely to break the
server later?

Maybe the proper way around that is to provide the ability for
pg_basebackup to take a full connection string, just like we allow
psql to do?

I'm not sure we should go the way of providing the "start slave".
Given thta how you want to start the slave differs so much on
platforms. The most glaring example is on windows you really need to
*start the service* rather than use pg_ctl. Sure, you can document
your way around that, but I'm not sure the functionality added is
really worth it. What about all the other potential connection
parameters?

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: pgsql-hackers(at)postgresql(dot)org, Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Subject: Re: [PATCH] Make pg_basebackup configure and start standby
Date: 2012-07-01 16:01:43
Message-ID: CAHGQGwFEA4nxMMob6rDByr6OzmeLjs_02pJ9XRn=VEq5sTCfVQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Jul 2, 2012 at 12:42 AM, Boszormenyi Zoltan <zb(at)cybertec(dot)at> wrote:
> Hi,
>
> 2012-07-01 17:38 keltezéssel, Fujii Masao írta:
>
>> On Sun, Jul 1, 2012 at 8:02 PM, Boszormenyi Zoltan <zb(at)cybertec(dot)at> wrote:
>>>
>>> Hi,
>>>
>>> attached is a patch that does $SUBJECT.
>>>
>>> It's a usability enhancement, to take a backup, write
>>> a minimalistic recovery.conf and start the streaming
>>> standby in one go.
>>>
>>> Comments?
>>
>> Could you add the patch to the next CommitFest?
>
>
> I will.
>
>
>> If the backup is taken from the standby server, the standby's
>> recovery.conf
>> is included in the backup. What happens in this case?
>
>
> As documented, the command line parameters of pg_basebackup
> will be used for recovery.conf. So, the new standby will replicate
> the previous one. Cascading replication works since 9.2.

So pg_basebackup overwrites the recovery.conf which was backed up
from the standby with the recovery.conf which was created by using
the command line parameters of pg_basebackup?

Regards,

--
Fujii Masao


From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Boszormenyi Zoltan <zb(at)cybertec(dot)at>, pgsql-hackers(at)postgresql(dot)org, Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Subject: Re: [PATCH] Make pg_basebackup configure and start standby
Date: 2012-07-01 16:10:09
Message-ID: CAHGQGwE2MbnZbigTEdZtjuR2XvdyS98QtWhV+UBC1dchqnzG9Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Jul 2, 2012 at 12:44 AM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> On Sun, Jul 1, 2012 at 1:02 PM, Boszormenyi Zoltan <zb(at)cybertec(dot)at> wrote:
>> Hi,
>>
>> attached is a patch that does $SUBJECT.
>>
>> It's a usability enhancement, to take a backup, write
>> a minimalistic recovery.conf and start the streaming
>> standby in one go.
>
> I like the writing of recovery.conf.

Agreed.

> In fact, I had it in my code at
> one very early point and took it out in order to get a clean patch
> ready :)
>
> But I think that part is lacking in functionality: AFAICT it's
> hardcoded to only handle host, port, user and password. What about
> other connection parameters, likely passed to pg_basebackup through
> the environment in that case? isn't that quite likely to break the
> server later?

What about something like PQconninfo which returns the connection
string value established at connection?

> Maybe the proper way around that is to provide the ability for
> pg_basebackup to take a full connection string, just like we allow
> psql to do?

+1

> I'm not sure we should go the way of providing the "start slave".
> Given thta how you want to start the slave differs so much on
> platforms. The most glaring example is on windows you really need to
> *start the service* rather than use pg_ctl. Sure, you can document
> your way around that, but I'm not sure the functionality added is
> really worth it.

Agreed.

Regards,

--
Fujii Masao


From: Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Boszormenyi Zoltan <zb(at)cybertec(dot)at>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Make pg_basebackup configure and start standby
Date: 2012-07-01 19:13:26
Message-ID: 881AF06B-DF0A-4E78-822B-C51C7E172606@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Jul 1, 2012, at 5:44 PM, Magnus Hagander wrote:

> On Sun, Jul 1, 2012 at 1:02 PM, Boszormenyi Zoltan <zb(at)cybertec(dot)at> wrote:
>> Hi,
>>
>> attached is a patch that does $SUBJECT.
>>
>> It's a usability enhancement, to take a backup, write
>> a minimalistic recovery.conf and start the streaming
>> standby in one go.
>
> I like the writing of recovery.conf. In fact, I had it in my code at
> one very early point and took it out in order to get a clean patch
> ready :)
>
> But I think that part is lacking in functionality: AFAICT it's
> hardcoded to only handle host, port, user and password. What about
> other connection parameters, likely passed to pg_basebackup through
> the environment in that case? isn't that quite likely to break the
> server later?
>

one option would be to check the environments and take them if needed.
however, i am not sure if this is a good idea either - just thing of PGPASSWORD or so. do we really want to take it and write it to a file straight away? i guess there are arguments for both ideas.

still, i guess your argument is a reasonable one.

> Maybe the proper way around that is to provide the ability for
> pg_basebackup to take a full connection string, just like we allow
> psql to do?
>

this would make things redundant. i am quite sure some users might not get the distinction straight away.

>
>
> I'm not sure we should go the way of providing the "start slave".
> Given thta how you want to start the slave differs so much on
> platforms. The most glaring example is on windows you really need to
> *start the service* rather than use pg_ctl. Sure, you can document
> your way around that, but I'm not sure the functionality added is
> really worth it. What about all the other potential connection
> parameters.

regards,

hans

--
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt
Web: http://www.postgresql-support.de


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Boszormenyi Zoltan <zb(at)cybertec(dot)at>, pgsql-hackers(at)postgresql(dot)org, Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Subject: Re: [PATCH] Make pg_basebackup configure and start standby
Date: 2012-07-03 19:47:29
Message-ID: 1341344849.21530.25.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On mån, 2012-07-02 at 01:10 +0900, Fujii Masao wrote:
> > But I think that part is lacking in functionality: AFAICT it's
> > hardcoded to only handle host, port, user and password. What about
> > other connection parameters, likely passed to pg_basebackup through
> > the environment in that case? isn't that quite likely to break the
> > server later?
>
> What about something like PQconninfo which returns the connection
> string value established at connection?
>
> > Maybe the proper way around that is to provide the ability for
> > pg_basebackup to take a full connection string, just like we allow
> > psql to do?
>
> +1
>
I think both of these would be necessary to make this work smoothly.

You also need to take into account situations like when pg_basebackup
found a server with the help of PG* environment variables that might no
longer be set when the server tries to start recovery. So you need
something like PQconninfo.


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Subject: Re: [PATCH] Make pg_basebackup configure and start standby
Date: 2012-10-03 08:25:07
Message-ID: CABUevEyEG=_DsZcCnsyhSzgwH2o2OevL5JP8iHMKWdpVB9053Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Jul 3, 2012 at 9:47 PM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> On mån, 2012-07-02 at 01:10 +0900, Fujii Masao wrote:
>> > But I think that part is lacking in functionality: AFAICT it's
>> > hardcoded to only handle host, port, user and password. What about
>> > other connection parameters, likely passed to pg_basebackup through
>> > the environment in that case? isn't that quite likely to break the
>> > server later?
>>
>> What about something like PQconninfo which returns the connection
>> string value established at connection?
>>
>> > Maybe the proper way around that is to provide the ability for
>> > pg_basebackup to take a full connection string, just like we allow
>> > psql to do?
>>
>> +1
>>
> I think both of these would be necessary to make this work smoothly.
>
> You also need to take into account situations like when pg_basebackup
> found a server with the help of PG* environment variables that might no
> longer be set when the server tries to start recovery. So you need
> something like PQconninfo.

Zoltan,

are you planning to work on the things discussed in this thread? I
notice the patch is sitting with "waiting on author" in the CF app -
so the second question is that if you are doing that, do you think it
will be done within the scope of the current CF?

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/


From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Subject: Re: [PATCH] Make pg_basebackup configure and start standby
Date: 2012-10-03 08:37:27
Message-ID: 506BF947.5060105@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

2012-10-03 10:25 keltezéssel, Magnus Hagander írta:
> On Tue, Jul 3, 2012 at 9:47 PM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
>> On mån, 2012-07-02 at 01:10 +0900, Fujii Masao wrote:
>>>> But I think that part is lacking in functionality: AFAICT it's
>>>> hardcoded to only handle host, port, user and password. What about
>>>> other connection parameters, likely passed to pg_basebackup through
>>>> the environment in that case? isn't that quite likely to break the
>>>> server later?
>>> What about something like PQconninfo which returns the connection
>>> string value established at connection?
>>>
>>>> Maybe the proper way around that is to provide the ability for
>>>> pg_basebackup to take a full connection string, just like we allow
>>>> psql to do?
>>> +1
>>>
>> I think both of these would be necessary to make this work smoothly.
>>
>> You also need to take into account situations like when pg_basebackup
>> found a server with the help of PG* environment variables that might no
>> longer be set when the server tries to start recovery. So you need
>> something like PQconninfo.
> Zoltan,
>
> are you planning to work on the things discussed in this thread? I
> notice the patch is sitting with "waiting on author" in the CF app -
> so the second question is that if you are doing that, do you think it
> will be done within the scope of the current CF?

yes, I am on it so it can be done in this CF.

Best regards,
Zoltán Böszörményi

--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
http://www.postgresql.at/


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Subject: Re: [PATCH] Make pg_basebackup configure and start standby
Date: 2012-10-03 08:44:32
Message-ID: CABUevEyiMHWyMZqTYr0+Cu827cGiM8jJX7_qAQ13mTQHa_bEpQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Oct 3, 2012 at 10:37 AM, Boszormenyi Zoltan <zb(at)cybertec(dot)at> wrote:
> Hi,
>
> 2012-10-03 10:25 keltezéssel, Magnus Hagander írta:
>>
>> On Tue, Jul 3, 2012 at 9:47 PM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
>>>
>>> On mĺn, 2012-07-02 at 01:10 +0900, Fujii Masao wrote:
>>>>>
>>>>> But I think that part is lacking in functionality: AFAICT it's
>>>>> hardcoded to only handle host, port, user and password. What about
>>>>> other connection parameters, likely passed to pg_basebackup through
>>>>> the environment in that case? isn't that quite likely to break the
>>>>> server later?
>>>>
>>>> What about something like PQconninfo which returns the connection
>>>> string value established at connection?
>>>>
>>>>> Maybe the proper way around that is to provide the ability for
>>>>> pg_basebackup to take a full connection string, just like we allow
>>>>> psql to do?
>>>>
>>>> +1
>>>>
>>> I think both of these would be necessary to make this work smoothly.
>>>
>>> You also need to take into account situations like when pg_basebackup
>>> found a server with the help of PG* environment variables that might no
>>> longer be set when the server tries to start recovery. So you need
>>> something like PQconninfo.
>>
>> Zoltan,
>>
>> are you planning to work on the things discussed in this thread? I
>> notice the patch is sitting with "waiting on author" in the CF app -
>> so the second question is that if you are doing that, do you think it
>> will be done within the scope of the current CF?
>
>
> yes, I am on it so it can be done in this CF.

Great, thanks!

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/


From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Subject: Re: [PATCH] Make pg_basebackup configure and start standby
Date: 2012-10-03 12:38:05
Message-ID: 506C31AD.1070004@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2012-07-01 18:01 keltezéssel, Fujii Masao írta:
> On Mon, Jul 2, 2012 at 12:42 AM, Boszormenyi Zoltan <zb(at)cybertec(dot)at> wrote:
>> Hi,
>>
>> 2012-07-01 17:38 keltezéssel, Fujii Masao írta:
>>
>>> On Sun, Jul 1, 2012 at 8:02 PM, Boszormenyi Zoltan <zb(at)cybertec(dot)at> wrote:
>>>> Hi,
>>>>
>>>> attached is a patch that does $SUBJECT.
>>>>
>>>> It's a usability enhancement, to take a backup, write
>>>> a minimalistic recovery.conf and start the streaming
>>>> standby in one go.
>>>>
>>>> Comments?
>>> Could you add the patch to the next CommitFest?
>>
>> I will.
>>
>>
>>> If the backup is taken from the standby server, the standby's
>>> recovery.conf
>>> is included in the backup. What happens in this case?
>>
>> As documented, the command line parameters of pg_basebackup
>> will be used for recovery.conf. So, the new standby will replicate
>> the previous one. Cascading replication works since 9.2.
> So pg_basebackup overwrites the recovery.conf which was backed up
> from the standby with the recovery.conf which was created by using
> the command line parameters of pg_basebackup?

Only if requested.

Best regards,
Zoltán Böszörményi

--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
http://www.postgresql.at/