pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedPassing connection string to pg_basebackup
13+ messages / 7 participants
[nested] [flat]
* Passing connection string to pg_basebackup
@ 2013-01-18 10:15 ` Heikki Linnakangas <hlinnakangas@vmware.com>
2013-01-18 13:43 ` Re: Passing connection string to pg_basebackup Dimitri Fontaine <dimitri@2ndQuadrant.fr>
1 sibling, 1 reply; 13+ messages in thread
From: Heikki Linnakangas @ 2013-01-18 10:15 UTC (permalink / raw)
To: Amit Kapila <amit.kapila@huawei.com>; +Cc: Boszormenyi Zoltan <zb@cybertec.at>; Hari Babu <haribabu.kommi@huawei.com>; Fujii Masao <masao.fujii@gmail.com>; pgsql-hackers@postgresql.org; Magnus Hagander <magnus@hagander.net>
On 18.01.2013 08:50, Amit Kapila wrote:
> I think currently user has no way to specify TCP keepalive settings from
> pg_basebackup, please let me know if there is any such existing way?
I was going to say you can just use "keepalives_idle=30" in the
connection string. But there's no way to pass a connection string to
pg_basebackup on the command line! The usual way to pass a connection
string is to pass it as the database name, and PQconnect will expand it,
but that doesn't work with pg_basebackup because it hardcodes the
database name as "replication". D'oh.
You could still use environment variables and a service file to do it,
but it's certainly more cumbersome. It clearly should be possible to
pass a full connection string to pg_basebackup, that's an obvious oversight.
- Heikki
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Passing connection string to pg_basebackup
2013-01-18 10:15 ` Passing connection string to pg_basebackup Heikki Linnakangas <hlinnakangas@vmware.com>
@ 2013-01-18 13:43 ` Dimitri Fontaine <dimitri@2ndQuadrant.fr>
2013-01-19 12:20 ` Re: Passing connection string to pg_basebackup Magnus Hagander <magnus@hagander.net>
0 siblings, 1 reply; 13+ messages in thread
From: Dimitri Fontaine @ 2013-01-18 13:43 UTC (permalink / raw)
To: Heikki Linnakangas <hlinnakangas@vmware.com>; +Cc: Amit Kapila <amit.kapila@huawei.com>; Boszormenyi Zoltan <zb@cybertec.at>; Hari Babu <haribabu.kommi@huawei.com>; Fujii Masao <masao.fujii@gmail.com>; pgsql-hackers@postgresql.org; Magnus Hagander <magnus@hagander.net>
Heikki Linnakangas <hlinnakangas@vmware.com> writes:
> You could still use environment variables and a service file to do it, but
> it's certainly more cumbersome. It clearly should be possible to pass a full
> connection string to pg_basebackup, that's an obvious oversight.
FWIW, +1. I would consider it a bugfix (backpatch, etc).
Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Passing connection string to pg_basebackup
2013-01-18 10:15 ` Passing connection string to pg_basebackup Heikki Linnakangas <hlinnakangas@vmware.com>
2013-01-18 13:43 ` Re: Passing connection string to pg_basebackup Dimitri Fontaine <dimitri@2ndQuadrant.fr>
@ 2013-01-19 12:20 ` Magnus Hagander <magnus@hagander.net>
2013-01-19 17:05 ` Re: Passing connection string to pg_basebackup Dimitri Fontaine <dimitri@2ndQuadrant.fr>
0 siblings, 1 reply; 13+ messages in thread
From: Magnus Hagander @ 2013-01-19 12:20 UTC (permalink / raw)
To: Dimitri Fontaine <dimitri@2ndquadrant.fr>; +Cc: Heikki Linnakangas <hlinnakangas@vmware.com>; Amit Kapila <amit.kapila@huawei.com>; Boszormenyi Zoltan <zb@cybertec.at>; Hari Babu <haribabu.kommi@huawei.com>; Fujii Masao <masao.fujii@gmail.com>; PostgreSQL-development <pgsql-hackers@postgresql.org>
On Fri, Jan 18, 2013 at 2:43 PM, Dimitri Fontaine
<dimitri@2ndquadrant.fr> wrote:
> Heikki Linnakangas <hlinnakangas@vmware.com> writes:
>> You could still use environment variables and a service file to do it, but
>> it's certainly more cumbersome. It clearly should be possible to pass a full
>> connection string to pg_basebackup, that's an obvious oversight.
>
> FWIW, +1. I would consider it a bugfix (backpatch, etc).
While it's a feature I'd very much like to see, I really don't think
you can consider it a bugfix. It's functionality that was left out -
it's not like we tried to implement it and it didn't work. We pushed
the whole implementation to "next version" (and then forgot about
actually putting it in the next version, until now)
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Passing connection string to pg_basebackup
2013-01-18 10:15 ` Passing connection string to pg_basebackup Heikki Linnakangas <hlinnakangas@vmware.com>
2013-01-18 13:43 ` Re: Passing connection string to pg_basebackup Dimitri Fontaine <dimitri@2ndQuadrant.fr>
2013-01-19 12:20 ` Re: Passing connection string to pg_basebackup Magnus Hagander <magnus@hagander.net>
@ 2013-01-19 17:05 ` Dimitri Fontaine <dimitri@2ndQuadrant.fr>
2013-01-19 17:33 ` Re: Passing connection string to pg_basebackup Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 13+ messages in thread
From: Dimitri Fontaine @ 2013-01-19 17:05 UTC (permalink / raw)
To: Magnus Hagander <magnus@hagander.net>; +Cc: Heikki Linnakangas <hlinnakangas@vmware.com>; Amit Kapila <amit.kapila@huawei.com>; Boszormenyi Zoltan <zb@cybertec.at>; Hari Babu <haribabu.kommi@huawei.com>; Fujii Masao <masao.fujii@gmail.com>; PostgreSQL-development <pgsql-hackers@postgresql.org>
Magnus Hagander <magnus@hagander.net> writes:
>> FWIW, +1. I would consider it a bugfix (backpatch, etc).
>
> While it's a feature I'd very much like to see, I really don't think
> you can consider it a bugfix. It's functionality that was left out -
> it's not like we tried to implement it and it didn't work. We pushed
> the whole implementation to "next version" (and then forgot about
> actually putting it in the next version, until now)
Thanks for reminding me about that, I completely forgot about all that.
On the other hand, discrepancies in between command line arguments
processing in our tools are already not helping our users (even if
pg_dump -d seems to have been fixed along the years); so much so that
I'm having a hard time finding any upside into having a different set of
command line argument capabilities for the same tool depending on the
major version.
We are not talking about a new feature per se, but exposing a feature
that about every other command line tool we ship have. So I think I'm
standing on my position that it should get backpatched as a "fix".
Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Passing connection string to pg_basebackup
2013-01-18 10:15 ` Passing connection string to pg_basebackup Heikki Linnakangas <hlinnakangas@vmware.com>
2013-01-18 13:43 ` Re: Passing connection string to pg_basebackup Dimitri Fontaine <dimitri@2ndQuadrant.fr>
2013-01-19 12:20 ` Re: Passing connection string to pg_basebackup Magnus Hagander <magnus@hagander.net>
2013-01-19 17:05 ` Re: Passing connection string to pg_basebackup Dimitri Fontaine <dimitri@2ndQuadrant.fr>
@ 2013-01-19 17:33 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-01-19 20:06 ` Re: Passing connection string to pg_basebackup Dimitri Fontaine <dimitri@2ndQuadrant.fr>
2013-01-20 16:45 ` Re: Passing connection string to pg_basebackup Robert Haas <robertmhaas@gmail.com>
0 siblings, 2 replies; 13+ messages in thread
From: Tom Lane @ 2013-01-19 17:33 UTC (permalink / raw)
To: Dimitri Fontaine <dimitri@2ndQuadrant.fr>; +Cc: Magnus Hagander <magnus@hagander.net>; Heikki Linnakangas <hlinnakangas@vmware.com>; Amit Kapila <amit.kapila@huawei.com>; Boszormenyi Zoltan <zb@cybertec.at>; Hari Babu <haribabu.kommi@huawei.com>; Fujii Masao <masao.fujii@gmail.com>; PostgreSQL-development <pgsql-hackers@postgresql.org>
Dimitri Fontaine <dimitri@2ndQuadrant.fr> writes:
> On the other hand, discrepancies in between command line arguments
> processing in our tools are already not helping our users (even if
> pg_dump -d seems to have been fixed along the years); so much so that
> I'm having a hard time finding any upside into having a different set of
> command line argument capabilities for the same tool depending on the
> major version.
> We are not talking about a new feature per se, but exposing a feature
> that about every other command line tool we ship have. So I think I'm
> standing on my position that it should get backpatched as a "fix".
I don't think that argument holds any water at all. There would still
be differences in command line argument capabilities out there ---
they'd just be between minor versions not major ones. That's not any
easier for people to deal with. And what will you say to someone whose
application got broken by a minor-version update?
If this feature were all that critical someone would have noticed its
lack before now, anyway. So I can't get excited about back-patching.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Passing connection string to pg_basebackup
2013-01-18 10:15 ` Passing connection string to pg_basebackup Heikki Linnakangas <hlinnakangas@vmware.com>
2013-01-18 13:43 ` Re: Passing connection string to pg_basebackup Dimitri Fontaine <dimitri@2ndQuadrant.fr>
2013-01-19 12:20 ` Re: Passing connection string to pg_basebackup Magnus Hagander <magnus@hagander.net>
2013-01-19 17:05 ` Re: Passing connection string to pg_basebackup Dimitri Fontaine <dimitri@2ndQuadrant.fr>
2013-01-19 17:33 ` Re: Passing connection string to pg_basebackup Tom Lane <tgl@sss.pgh.pa.us>
@ 2013-01-19 20:06 ` Dimitri Fontaine <dimitri@2ndQuadrant.fr>
1 sibling, 0 replies; 13+ messages in thread
From: Dimitri Fontaine @ 2013-01-19 20:06 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Magnus Hagander <magnus@hagander.net>; Heikki Linnakangas <hlinnakangas@vmware.com>; Amit Kapila <amit.kapila@huawei.com>; Boszormenyi Zoltan <zb@cybertec.at>; Hari Babu <haribabu.kommi@huawei.com>; Fujii Masao <masao.fujii@gmail.com>; PostgreSQL-development <pgsql-hackers@postgresql.org>
Tom Lane <tgl@sss.pgh.pa.us> writes:
> I don't think that argument holds any water at all. There would still
> be differences in command line argument capabilities out there ---
> they'd just be between minor versions not major ones. That's not any
> easier for people to deal with. And what will you say to someone whose
> application got broken by a minor-version update?
Fair enough, I suppose.
Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Passing connection string to pg_basebackup
2013-01-18 10:15 ` Passing connection string to pg_basebackup Heikki Linnakangas <hlinnakangas@vmware.com>
2013-01-18 13:43 ` Re: Passing connection string to pg_basebackup Dimitri Fontaine <dimitri@2ndQuadrant.fr>
2013-01-19 12:20 ` Re: Passing connection string to pg_basebackup Magnus Hagander <magnus@hagander.net>
2013-01-19 17:05 ` Re: Passing connection string to pg_basebackup Dimitri Fontaine <dimitri@2ndQuadrant.fr>
2013-01-19 17:33 ` Re: Passing connection string to pg_basebackup Tom Lane <tgl@sss.pgh.pa.us>
@ 2013-01-20 16:45 ` Robert Haas <robertmhaas@gmail.com>
1 sibling, 0 replies; 13+ messages in thread
From: Robert Haas @ 2013-01-20 16:45 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Dimitri Fontaine <dimitri@2ndquadrant.fr>; Magnus Hagander <magnus@hagander.net>; Heikki Linnakangas <hlinnakangas@vmware.com>; Amit Kapila <amit.kapila@huawei.com>; Boszormenyi Zoltan <zb@cybertec.at>; Hari Babu <haribabu.kommi@huawei.com>; Fujii Masao <masao.fujii@gmail.com>; PostgreSQL-development <pgsql-hackers@postgresql.org>
On Sat, Jan 19, 2013 at 12:33 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Dimitri Fontaine <dimitri@2ndQuadrant.fr> writes:
>> On the other hand, discrepancies in between command line arguments
>> processing in our tools are already not helping our users (even if
>> pg_dump -d seems to have been fixed along the years); so much so that
>> I'm having a hard time finding any upside into having a different set of
>> command line argument capabilities for the same tool depending on the
>> major version.
>
>> We are not talking about a new feature per se, but exposing a feature
>> that about every other command line tool we ship have. So I think I'm
>> standing on my position that it should get backpatched as a "fix".
>
> I don't think that argument holds any water at all. There would still
> be differences in command line argument capabilities out there ---
> they'd just be between minor versions not major ones. That's not any
> easier for people to deal with. And what will you say to someone whose
> application got broken by a minor-version update?
I heartily agree. I can say from firsthand experience that when minor
releases break things for customers (and they do), the customers get
*really* cranky. Based on recent experience, I think we should be
tightening our standards for what gets back-patched, not loosening
them. (No, I don't have a specific example off-hand, sorry.)
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Passing connection string to pg_basebackup
@ 2013-01-18 11:41 ` Amit Kapila <amit.kapila@huawei.com>
2013-01-18 12:05 ` Re: Passing connection string to pg_basebackup Heikki Linnakangas <hlinnakangas@vmware.com>
1 sibling, 1 reply; 13+ messages in thread
From: Amit Kapila @ 2013-01-18 11:41 UTC (permalink / raw)
To: 'Heikki Linnakangas' <hlinnakangas@vmware.com>; +Cc: 'Boszormenyi Zoltan' <zb@cybertec.at>; 'Hari Babu' <haribabu.kommi@huawei.com>; 'Fujii Masao' <masao.fujii@gmail.com>; pgsql-hackers@postgresql.org; 'Magnus Hagander' <magnus@hagander.net>
On Friday, January 18, 2013 3:46 PM Heikki Linnakangas wrote:
> On 18.01.2013 08:50, Amit Kapila wrote:
> > I think currently user has no way to specify TCP keepalive settings
> from
> > pg_basebackup, please let me know if there is any such existing way?
>
> I was going to say you can just use "keepalives_idle=30" in the
> connection string. But there's no way to pass a connection string to
> pg_basebackup on the command line! The usual way to pass a connection
> string is to pass it as the database name, and PQconnect will expand
> it,
> but that doesn't work with pg_basebackup because it hardcodes the
> database name as "replication". D'oh.
>
> You could still use environment variables and a service file to do it,
> but it's certainly more cumbersome. It clearly should be possible to
> pass a full connection string to pg_basebackup, that's an obvious
> oversight.
So to solve this problem below can be done:
1. Support connection string in pg_basebackup and mention keepalives or
connection_timeout
2. Support recv_timeout separately to provide a way to users who are not
comfortable tcp keepalives
a. 1 can be done alone
b. 2 can be done alone
c. both 1 and 2.
With Regards,
Amit Kapila.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Passing connection string to pg_basebackup
2013-01-18 11:41 ` Re: Passing connection string to pg_basebackup Amit Kapila <amit.kapila@huawei.com>
@ 2013-01-18 12:05 ` Heikki Linnakangas <hlinnakangas@vmware.com>
2013-01-18 13:24 ` Re: Passing connection string to pg_basebackup Amit Kapila <amit.kapila@huawei.com>
2013-01-19 12:19 ` Re: Passing connection string to pg_basebackup Magnus Hagander <magnus@hagander.net>
0 siblings, 2 replies; 13+ messages in thread
From: Heikki Linnakangas @ 2013-01-18 12:05 UTC (permalink / raw)
To: Amit Kapila <amit.kapila@huawei.com>; +Cc: Boszormenyi Zoltan <zb@cybertec.at>; Hari Babu <haribabu.kommi@huawei.com>; Fujii Masao <masao.fujii@gmail.com>; pgsql-hackers@postgresql.org; Magnus Hagander <magnus@hagander.net>
On 18.01.2013 13:41, Amit Kapila wrote:
> On Friday, January 18, 2013 3:46 PM Heikki Linnakangas wrote:
>> On 18.01.2013 08:50, Amit Kapila wrote:
>>> I think currently user has no way to specify TCP keepalive settings
>> from
>>> pg_basebackup, please let me know if there is any such existing way?
>>
>> I was going to say you can just use "keepalives_idle=30" in the
>> connection string. But there's no way to pass a connection string to
>> pg_basebackup on the command line! The usual way to pass a connection
>> string is to pass it as the database name, and PQconnect will expand
>> it,
>> but that doesn't work with pg_basebackup because it hardcodes the
>> database name as "replication". D'oh.
>>
>> You could still use environment variables and a service file to do it,
>> but it's certainly more cumbersome. It clearly should be possible to
>> pass a full connection string to pg_basebackup, that's an obvious
>> oversight.
>
> So to solve this problem below can be done:
> 1. Support connection string in pg_basebackup and mention keepalives or
> connection_timeout
> 2. Support recv_timeout separately to provide a way to users who are not
> comfortable tcp keepalives
>
> a. 1 can be done alone
> b. 2 can be done alone
> c. both 1 and 2.
Right. Let's do just 1 for now. An general application level, non-TCP,
keepalive message at the libpq level might be a good idea, but that's a
much larger patch, definitely not 9.3 material.
- Heikki
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Passing connection string to pg_basebackup
2013-01-18 11:41 ` Re: Passing connection string to pg_basebackup Amit Kapila <amit.kapila@huawei.com>
2013-01-18 12:05 ` Re: Passing connection string to pg_basebackup Heikki Linnakangas <hlinnakangas@vmware.com>
@ 2013-01-18 13:24 ` Amit Kapila <amit.kapila@huawei.com>
1 sibling, 0 replies; 13+ messages in thread
From: Amit Kapila @ 2013-01-18 13:24 UTC (permalink / raw)
To: 'Heikki Linnakangas' <hlinnakangas@vmware.com>; +Cc: 'Boszormenyi Zoltan' <zb@cybertec.at>; 'Hari Babu' <haribabu.kommi@huawei.com>; 'Fujii Masao' <masao.fujii@gmail.com>; pgsql-hackers@postgresql.org; 'Magnus Hagander' <magnus@hagander.net>
On Friday, January 18, 2013 5:35 PM Heikki Linnakangas wrote:
> On 18.01.2013 13:41, Amit Kapila wrote:
> > On Friday, January 18, 2013 3:46 PM Heikki Linnakangas wrote:
> >> On 18.01.2013 08:50, Amit Kapila wrote:
> >>> I think currently user has no way to specify TCP keepalive settings
> >> from
> >>> pg_basebackup, please let me know if there is any such existing
> way?
> >>
> >> I was going to say you can just use "keepalives_idle=30" in the
> >> connection string. But there's no way to pass a connection string to
> >> pg_basebackup on the command line! The usual way to pass a
> connection
> >> string is to pass it as the database name, and PQconnect will expand
> >> it,
> >> but that doesn't work with pg_basebackup because it hardcodes the
> >> database name as "replication". D'oh.
> >>
> >> You could still use environment variables and a service file to do
> it,
> >> but it's certainly more cumbersome. It clearly should be possible to
> >> pass a full connection string to pg_basebackup, that's an obvious
> >> oversight.
> >
> > So to solve this problem below can be done:
> > 1. Support connection string in pg_basebackup and mention keepalives
> or
> > connection_timeout
> > 2. Support recv_timeout separately to provide a way to users who are
> not
> > comfortable tcp keepalives
> >
> > a. 1 can be done alone
> > b. 2 can be done alone
> > c. both 1 and 2.
>
> Right. Let's do just 1 for now.
I shall fix it as Review comment and update the patch and change the
location from CF-3 to current CF.
> An general application level, non-TCP,
> keepalive message at the libpq level might be a good idea, but that's a
> much larger patch, definitely not 9.3 material.
With Regards,
Amit Kapila.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Passing connection string to pg_basebackup
2013-01-18 11:41 ` Re: Passing connection string to pg_basebackup Amit Kapila <amit.kapila@huawei.com>
2013-01-18 12:05 ` Re: Passing connection string to pg_basebackup Heikki Linnakangas <hlinnakangas@vmware.com>
@ 2013-01-19 12:19 ` Magnus Hagander <magnus@hagander.net>
2013-01-22 09:56 ` Re: Passing connection string to pg_basebackup Hari Babu <haribabu.kommi@huawei.com>
2013-01-24 15:13 ` Re: Passing connection string to pg_basebackup Hari Babu <haribabu.kommi@huawei.com>
1 sibling, 2 replies; 13+ messages in thread
From: Magnus Hagander @ 2013-01-19 12:19 UTC (permalink / raw)
To: Heikki Linnakangas <hlinnakangas@vmware.com>; +Cc: Amit Kapila <amit.kapila@huawei.com>; Boszormenyi Zoltan <zb@cybertec.at>; Hari Babu <haribabu.kommi@huawei.com>; Fujii Masao <masao.fujii@gmail.com>; PostgreSQL-development <pgsql-hackers@postgresql.org>
On Fri, Jan 18, 2013 at 1:05 PM, Heikki Linnakangas
<hlinnakangas@vmware.com> wrote:
> On 18.01.2013 13:41, Amit Kapila wrote:
>>
>> On Friday, January 18, 2013 3:46 PM Heikki Linnakangas wrote:
>>>
>>> On 18.01.2013 08:50, Amit Kapila wrote:
>>>>
>>>> I think currently user has no way to specify TCP keepalive settings
>>>
>>> from
>>>>
>>>> pg_basebackup, please let me know if there is any such existing way?
>>>
>>>
>>> I was going to say you can just use "keepalives_idle=30" in the
>>> connection string. But there's no way to pass a connection string to
>>> pg_basebackup on the command line! The usual way to pass a connection
>>> string is to pass it as the database name, and PQconnect will expand
>>> it,
>>> but that doesn't work with pg_basebackup because it hardcodes the
>>> database name as "replication". D'oh.
>>>
>>> You could still use environment variables and a service file to do it,
>>> but it's certainly more cumbersome. It clearly should be possible to
>>> pass a full connection string to pg_basebackup, that's an obvious
>>> oversight.
>>
>>
>> So to solve this problem below can be done:
>> 1. Support connection string in pg_basebackup and mention keepalives or
>> connection_timeout
>> 2. Support recv_timeout separately to provide a way to users who are not
>> comfortable tcp keepalives
>>
>> a. 1 can be done alone
>> b. 2 can be done alone
>> c. both 1 and 2.
>
>
> Right. Let's do just 1 for now. An general application level, non-TCP,
> keepalive message at the libpq level might be a good idea, but that's a much
> larger patch, definitely not 9.3 material.
+1 for doing 1 now. But actually, I think we can just keep it that way
in the future as well. If you need to specify these fairly advanced
options, using a connection string really isn't a problem.
I think it would be more worthwhile to go through the rest of the
tools in bin/ and make sure they *all* support connection strings.
And, an important point, do it the same way.
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Passing connection string to pg_basebackup
2013-01-18 11:41 ` Re: Passing connection string to pg_basebackup Amit Kapila <amit.kapila@huawei.com>
2013-01-18 12:05 ` Re: Passing connection string to pg_basebackup Heikki Linnakangas <hlinnakangas@vmware.com>
2013-01-19 12:19 ` Re: Passing connection string to pg_basebackup Magnus Hagander <magnus@hagander.net>
@ 2013-01-22 09:56 ` Hari Babu <haribabu.kommi@huawei.com>
1 sibling, 0 replies; 13+ messages in thread
From: Hari Babu @ 2013-01-22 09:56 UTC (permalink / raw)
To: 'Magnus Hagander' <magnus@hagander.net>; 'Heikki Linnakangas' <hlinnakangas@vmware.com>; +Cc: 'Amit Kapila' <amit.kapila@huawei.com>; 'Boszormenyi Zoltan' <zb@cybertec.at>; 'Fujii Masao' <masao.fujii@gmail.com>; 'PostgreSQL-development' <pgsql-hackers@postgresql.org>
On Saturday, January 19, 2013 5:49 PM Magnus Hagander wrote:
>On Fri, Jan 18, 2013 at 1:05 PM, Heikki Linnakangas
><hlinnakangas@vmware.com> wrote:
>> On 18.01.2013 13:41, Amit Kapila wrote:
>>>
>>> On Friday, January 18, 2013 3:46 PM Heikki Linnakangas wrote:
>>>>
>>>> On 18.01.2013 08:50, Amit Kapila wrote:
>>> So to solve this problem below can be done:
>>> 1. Support connection string in pg_basebackup and mention keepalives or
>>> connection_timeout
>>> 2. Support recv_timeout separately to provide a way to users who are not
>>> comfortable tcp keepalives
>>>
>>> a. 1 can be done alone
>>> b. 2 can be done alone
>>> c. both 1 and 2.
>>
>>
>> Right. Let's do just 1 for now. An general application level, non-TCP,
>> keepalive message at the libpq level might be a good idea, but that's a
much
>> larger patch, definitely not 9.3 material.
>
>+1 for doing 1 now. But actually, I think we can just keep it that way
>in the future as well. If you need to specify these fairly advanced
>options, using a connection string really isn't a problem.
>
>I think it would be more worthwhile to go through the rest of the
>tools in bin/ and make sure they *all* support connection strings.
>And, an important point, do it the same way.
Presently I am trying to implement the option-1 by adding an extra command
line
Option -C "connection_string" to pg_basebackup and pg_receivexlog.
This option can be used with all the tools in bin folder.
The existing command line options to the tools are not planned to remove as
of now.
To handle both options, we can follow these approaches.
1. To make the code simpler, the connection string is formed inside with the
existing
command line options, if the user is not provided the "connection_string"
option.
which is used for further processing.
2. The connection_string and existing command line options are handled
separately.
I feel approach-1 is better. Please provide your suggestions on the same.
Regards,
Hari babu.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Passing connection string to pg_basebackup
2013-01-18 11:41 ` Re: Passing connection string to pg_basebackup Amit Kapila <amit.kapila@huawei.com>
2013-01-18 12:05 ` Re: Passing connection string to pg_basebackup Heikki Linnakangas <hlinnakangas@vmware.com>
2013-01-19 12:19 ` Re: Passing connection string to pg_basebackup Magnus Hagander <magnus@hagander.net>
@ 2013-01-24 15:13 ` Hari Babu <haribabu.kommi@huawei.com>
1 sibling, 0 replies; 13+ messages in thread
From: Hari Babu @ 2013-01-24 15:13 UTC (permalink / raw)
To: 'Magnus Hagander' <magnus@hagander.net>; 'Heikki Linnakangas' <hlinnakangas@vmware.com>; +Cc: 'Amit Kapila' <amit.kapila@huawei.com>; 'Boszormenyi Zoltan' <zb@cybertec.at>; 'Fujii Masao' <masao.fujii@gmail.com>; 'PostgreSQL-development' <pgsql-hackers@postgresql.org>
On Tue, Jan 22, 2013 3:27 PM Hari Babu wrote:
>On Saturday, January 19, 2013 5:49 PM Magnus Hagander wrote:
>>On Fri, Jan 18, 2013 at 1:05 PM, Heikki Linnakangas
>><hlinnakangas@vmware.com> wrote:
>>> On 18.01.2013 13:41, Amit Kapila wrote:
>>>>
>>>> On Friday, January 18, 2013 3:46 PM Heikki Linnakangas wrote:
>>>>>
>>>>> On 18.01.2013 08:50, Amit Kapila wrote:
>>>> So to solve this problem below can be done:
>>>> 1. Support connection string in pg_basebackup and mention keepalives or
>>>> connection_timeout
>>>> 2. Support recv_timeout separately to provide a way to users who are
not
>>>> comfortable tcp keepalives
>>>>
>>>> a. 1 can be done alone
>>>> b. 2 can be done alone
>>>> c. both 1 and 2.
>>>
>>>
>>> Right. Let's do just 1 for now. An general application level, non-TCP,
>>> keepalive message at the libpq level might be a good idea, but that's a
much
>>> larger patch, definitely not 9.3 material.
>>
>>+1 for doing 1 now. But actually, I think we can just keep it that way
>>in the future as well. If you need to specify these fairly advanced
>>options, using a connection string really isn't a problem.
>>
>>I think it would be more worthwhile to go through the rest of the
>>tools in bin/ and make sure they *all* support connection strings.
>>And, an important point, do it the same way.
>
>Presently I am trying to implement the option-1 by adding an extra command
line
>Option -C "connection_string" to pg_basebackup and pg_receivexlog.
>This option can be used with all the tools in bin folder.
>
>The existing command line options to the tools are not planned to remove as
of now.
>
>To handle both options, we can follow these approaches.
>
>1. To make the code simpler, the connection string is formed inside with
the existing
>command line options, if the user is not provided the "connection_string"
option.
>which is used for further processing.
>
>2. The connection_string and existing command line options are handled
separately.
>
>I feel approach-1 is better. Please provide your suggestions on the same.
Here is the patch which handles taking of connection string as an argument
to pg_basebackup and pg_receivexlog.
Description of changes:
1. New command line "-C connection-string"option is added for passing the
connection string.
2. Used "PQconnectdb" function for connecting to server instead of existing
function "PQconnectdbParams".
3. The existing command line parameters are formed in a string and passed to
"PQconnectdb" function.
4. With the connection string, if user provides additional options with
existing command line options, higher priority is given for the additional
options.
5. "conninfo_parse" function is modified to handle of single quote in the
password provided as input.
please provide your suggestions.
Regards,
Hari babu.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Attachments:
pg_basebkup_recvxlog_conn_string_v1.patch (application/octet-stream, 12.1K) download
*** a/doc/src/sgml/ref/pg_basebackup.sgml
--- b/doc/src/sgml/ref/pg_basebackup.sgml
***************
*** 357,362 **** PostgreSQL documentation
--- 357,375 ----
<para>
The following command-line options control the database connection parameters.
+ <variablelist>
+ <varlistentry>
+ <term><option>-C <replaceable class="parameter">"OPTIONS"</replaceable></option></term>
+ <term><option>--connection-string=<replaceable class="parameter">"OPTIONS"</replaceable></option></term>
+ <listitem>
+ <para>
+ Specifies connection string options, used for connecting to server.
+ These option can be used along with other user supplied options.
+ In case of conflicting option user supplied option is choosen.
+ </para>
+ </listitem>
+ </varlistentry>
+
<variablelist>
<varlistentry>
<term><option>-h <replaceable class="parameter">host</replaceable></option></term>
*** a/doc/src/sgml/ref/pg_receivexlog.sgml
--- b/doc/src/sgml/ref/pg_receivexlog.sgml
***************
*** 121,126 **** PostgreSQL documentation
--- 121,139 ----
<para>
The following command-line options control the database connection parameters.
+ <variablelist>
+ <varlistentry>
+ <term><option>-C <replaceable class="parameter">"OPTIONS"</replaceable></option></term>
+ <term><option>--connection-string=<replaceable class="parameter">"OPTIONS"</replaceable></option></term>
+ <listitem>
+ <para>
+ Specifies connection string options, used for connecting to server.
+ These option can be used along with other user supplied options.
+ In case of conflicting option user supplied option is choosen.
+ </para>
+ </listitem>
+ </varlistentry>
+
<variablelist>
<varlistentry>
<term><option>-h <replaceable class="parameter">host</replaceable></option></term>
*** a/src/bin/pg_basebackup/pg_basebackup.c
--- b/src/bin/pg_basebackup/pg_basebackup.c
***************
*** 126,131 **** usage(void)
--- 126,132 ----
printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -?, --help show this help, then exit\n"));
printf(_("\nConnection options:\n"));
+ printf(_(" -C, --connection-string=\"OPTIONS\" Connect to server using OPTIONS\n"));
printf(_(" -h, --host=HOSTNAME database server host or socket directory\n"));
printf(_(" -p, --port=PORT database server port number\n"));
printf(_(" -s, --status-interval=INTERVAL\n"
***************
*** 1104,1125 **** ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum)
}
/*
- * Escape single quotes used in connection parameters
- */
- static char *
- escape_quotes(const char *src)
- {
- char *result = escape_single_quotes_ascii(src);
-
- if (!result)
- {
- fprintf(stderr, _("%s: out of memory\n"), progname);
- exit(1);
- }
- return result;
- }
-
- /*
* Create a recovery.conf file in memory using a PQExpBuffer
*/
static void
--- 1105,1110 ----
***************
*** 1532,1537 **** main(int argc, char **argv)
--- 1517,1523 ----
{"pgdata", required_argument, NULL, 'D'},
{"format", required_argument, NULL, 'F'},
{"checkpoint", required_argument, NULL, 'c'},
+ {"connection-string", required_argument, NULL, 'C'},
{"write-recovery-conf", no_argument, NULL, 'R'},
{"xlog", no_argument, NULL, 'x'},
{"xlog-method", required_argument, NULL, 'X'},
***************
*** 1570,1576 **** main(int argc, char **argv)
}
}
! while ((c = getopt_long(argc, argv, "D:F:RxX:l:zZ:c:h:p:U:s:wWvP",
long_options, &option_index)) != -1)
{
switch (c)
--- 1556,1562 ----
}
}
! while ((c = getopt_long(argc, argv, "D:F:RxX:l:zZ:C:c:h:p:U:s:wWvP",
long_options, &option_index)) != -1)
{
switch (c)
***************
*** 1661,1666 **** main(int argc, char **argv)
--- 1647,1655 ----
exit(1);
}
break;
+ case 'C':
+ connection_string = pg_strdup(optarg);
+ break;
case 'h':
dbhost = pg_strdup(optarg);
break;
*** a/src/bin/pg_basebackup/pg_receivexlog.c
--- b/src/bin/pg_basebackup/pg_receivexlog.c
***************
*** 58,63 **** usage(void)
--- 58,64 ----
printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -?, --help show this help, then exit\n"));
printf(_("\nConnection options:\n"));
+ printf(_(" -C, --connection-string=\"OPTIONS\" Connect to server using OPTIONS\n"));
printf(_(" -h, --host=HOSTNAME database server host or socket directory\n"));
printf(_(" -p, --port=PORT database server port number\n"));
printf(_(" -s, --status-interval=INTERVAL\n"
***************
*** 305,310 **** main(int argc, char **argv)
--- 306,312 ----
static struct option long_options[] = {
{"help", no_argument, NULL, '?'},
{"version", no_argument, NULL, 'V'},
+ {"connection-string", required_argument, NULL, 'C'},
{"directory", required_argument, NULL, 'D'},
{"host", required_argument, NULL, 'h'},
{"port", required_argument, NULL, 'p'},
***************
*** 338,348 **** main(int argc, char **argv)
}
}
! while ((c = getopt_long(argc, argv, "D:h:p:U:s:nwWv",
long_options, &option_index)) != -1)
{
switch (c)
{
case 'D':
basedir = pg_strdup(optarg);
break;
--- 340,353 ----
}
}
! while ((c = getopt_long(argc, argv, "C:D:h:p:U:s:nwWv",
long_options, &option_index)) != -1)
{
switch (c)
{
+ case 'C':
+ connection_string = pg_strdup(optarg);
+ break;
case 'D':
basedir = pg_strdup(optarg);
break;
*** a/src/bin/pg_basebackup/streamutil.c
--- b/src/bin/pg_basebackup/streamutil.c
***************
*** 24,29 **** char *dbport = NULL;
--- 24,47 ----
int dbgetpassword = 0; /* 0=auto, -1=never, 1=always */
static char *dbpassword = NULL;
PGconn *conn = NULL;
+ char *connection_string = NULL;
+
+
+ /*
+ * Escape single quotes used in connection parameters
+ */
+ char *
+ escape_quotes(const char *src)
+ {
+ char *result = escape_single_quotes_ascii(src);
+
+ if (!result)
+ {
+ fprintf(stderr, _("%s: out of memory\n"), progname);
+ exit(1);
+ }
+ return result;
+ }
/*
* strdup() and malloc() replacements that print an error and exit
***************
*** 71,119 **** PGconn *
GetConnection(void)
{
PGconn *tmpconn;
- int argcount = 4; /* dbname, replication, fallback_app_name,
- * password */
- int i;
- const char **keywords;
- const char **values;
char *password = NULL;
const char *tmpparam;
!
! if (dbhost)
! argcount++;
! if (dbuser)
! argcount++;
! if (dbport)
! argcount++;
!
! keywords = pg_malloc0((argcount + 1) * sizeof(*keywords));
! values = pg_malloc0((argcount + 1) * sizeof(*values));
!
! keywords[0] = "dbname";
! values[0] = "replication";
! keywords[1] = "replication";
! values[1] = "true";
! keywords[2] = "fallback_application_name";
! values[2] = progname;
! i = 3;
if (dbhost)
! {
! keywords[i] = "host";
! values[i] = dbhost;
! i++;
! }
if (dbuser)
! {
! keywords[i] = "user";
! values[i] = dbuser;
! i++;
! }
if (dbport)
! {
! keywords[i] = "port";
! values[i] = dbport;
! i++;
! }
while (true)
{
--- 89,122 ----
GetConnection(void)
{
PGconn *tmpconn;
char *password = NULL;
const char *tmpparam;
! char conninfo[MAXCONNINFO];
! int conn_len = 0;
! char *conninfo_ptr = conninfo;
!
! /*
! * Connect using deliberately undocumented parameter: replication. The
! * database name is ignored by the server in replication mode.
! */
! conn_len += snprintf(conninfo_ptr, (sizeof(conninfo) - conn_len),
! "%s dbname=replication replication=true fallback_application_name='%s' ",
! connection_string ? connection_string : "", progname);
!
! /*
! * Extra options provided are added at the end of connection string.
! */
if (dbhost)
! conn_len += snprintf((conninfo_ptr + conn_len), (sizeof(conninfo) - conn_len),
! "host='%s' ", dbhost);
!
if (dbuser)
! conn_len += snprintf((conninfo_ptr + conn_len), (sizeof(conninfo) - conn_len),
! "user=%s ", dbuser);
!
if (dbport)
! conn_len += snprintf((conninfo_ptr + conn_len), (sizeof(conninfo) - conn_len),
! "port=%s ", dbport);
while (true)
{
***************
*** 127,144 **** GetConnection(void)
* meaning this is the call for a second session to the same
* database, so just forcibly reuse that password.
*/
! keywords[argcount - 1] = "password";
! values[argcount - 1] = dbpassword;
dbgetpassword = -1; /* Don't try again if this fails */
}
else if (dbgetpassword == 1)
{
password = simple_prompt(_("Password: "), 100, false);
! keywords[argcount - 1] = "password";
! values[argcount - 1] = password;
}
! tmpconn = PQconnectdbParams(keywords, values, true);
/*
* If there is too little memory even to allocate the PGconn object
--- 130,147 ----
* meaning this is the call for a second session to the same
* database, so just forcibly reuse that password.
*/
! snprintf((conninfo_ptr + conn_len), (sizeof(conninfo) - conn_len),
! "password='%s' ", escape_quotes(dbpassword));
dbgetpassword = -1; /* Don't try again if this fails */
}
else if (dbgetpassword == 1)
{
password = simple_prompt(_("Password: "), 100, false);
! snprintf((conninfo_ptr + conn_len), (sizeof(conninfo) - conn_len),
! "password='%s' ", escape_quotes(password));
}
! tmpconn = PQconnectdb(conninfo);
/*
* If there is too little memory even to allocate the PGconn object
***************
*** 165,179 **** GetConnection(void)
fprintf(stderr, _("%s: could not connect to server: %s\n"),
progname, PQerrorMessage(tmpconn));
PQfinish(tmpconn);
- free(values);
- free(keywords);
return NULL;
}
- /* Connection ok! */
- free(values);
- free(keywords);
-
/*
* Ensure we have the same value of integer timestamps as the server
* we are connecting to.
--- 168,176 ----
*** a/src/bin/pg_basebackup/streamutil.h
--- b/src/bin/pg_basebackup/streamutil.h
***************
*** 5,10 **** extern char *dbhost;
--- 5,11 ----
extern char *dbuser;
extern char *dbport;
extern int dbgetpassword;
+ extern char *connection_string;
/* Connection kept global so we can disconnect easily */
extern PGconn *conn;
***************
*** 15,20 **** extern PGconn *conn;
--- 16,22 ----
exit(code); \
}
+ extern char *escape_quotes(const char *src);
extern char *pg_strdup(const char *s);
extern void *pg_malloc0(size_t size);
*** a/src/include/pg_config_manual.h
--- b/src/include/pg_config_manual.h
***************
*** 200,205 ****
--- 200,211 ----
#endif
/*
+ * MAXCONNINFO: maximum size of a connection string.
+ */
+ #define MAXCONNINFO 1024
+
+
+ /*
*------------------------------------------------------------------------
* The following symbols are for enabling debugging code, not for
* controlling user-visible features or resource limits.
*** a/src/include/replication/walreceiver.h
--- b/src/include/replication/walreceiver.h
***************
*** 23,35 **** extern int wal_receiver_status_interval;
extern int wal_receiver_timeout;
extern bool hot_standby_feedback;
- /*
- * MAXCONNINFO: maximum size of a connection string.
- *
- * XXX: Should this move to pg_config_manual.h?
- */
- #define MAXCONNINFO 1024
-
/* Can we allow the standby to accept replication connection from another standby? */
#define AllowCascadeReplication() (EnableHotStandby && max_wal_senders > 0)
--- 23,28 ----
*** a/src/interfaces/libpq/fe-connect.c
--- b/src/interfaces/libpq/fe-connect.c
***************
*** 4216,4224 **** conninfo_parse(const char *conninfo, PQExpBuffer errorMessage,
}
if (*cp == '\'')
{
- *cp2 = '\0';
cp++;
! break;
}
*cp2++ = *cp++;
}
--- 4216,4227 ----
}
if (*cp == '\'')
{
cp++;
! if (*cp != '\'')
! {
! *cp2 = '\0';
! break;
! }
}
*cp2++ = *cp++;
}
=
^ permalink raw reply [nested|flat] 13+ messages in thread
end of thread, other threads:[~2013-01-24 15:13 UTC | newest]
Thread overview: 13+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-01-18 10:15 ` Heikki Linnakangas <hlinnakangas@vmware.com>
2013-01-18 13:43 ` Dimitri Fontaine <dimitri@2ndQuadrant.fr>
2013-01-19 12:20 ` Magnus Hagander <magnus@hagander.net>
2013-01-19 17:05 ` Dimitri Fontaine <dimitri@2ndQuadrant.fr>
2013-01-19 17:33 ` Tom Lane <tgl@sss.pgh.pa.us>
2013-01-19 20:06 ` Dimitri Fontaine <dimitri@2ndQuadrant.fr>
2013-01-20 16:45 ` Robert Haas <robertmhaas@gmail.com>
2013-01-18 11:41 ` Amit Kapila <amit.kapila@huawei.com>
2013-01-18 12:05 ` Heikki Linnakangas <hlinnakangas@vmware.com>
2013-01-18 13:24 ` Amit Kapila <amit.kapila@huawei.com>
2013-01-19 12:19 ` Magnus Hagander <magnus@hagander.net>
2013-01-22 09:56 ` Hari Babu <haribabu.kommi@huawei.com>
2013-01-24 15:13 ` Hari Babu <haribabu.kommi@huawei.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox