Re: Passing connection string to pg_basebackup

From: Hari Babu <haribabu(dot)kommi(at)huawei(dot)com>
To: "'Magnus Hagander'" <magnus(at)hagander(dot)net>, "'Heikki Linnakangas'" <hlinnakangas(at)vmware(dot)com>
Cc: "'Amit Kapila'" <amit(dot)kapila(at)huawei(dot)com>, "'Boszormenyi Zoltan'" <zb(at)cybertec(dot)at>, "'Fujii Masao'" <masao(dot)fujii(at)gmail(dot)com>, "'PostgreSQL-development'" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Passing connection string to pg_basebackup
Date: 2013-01-24 15:13:50
Message-ID: 005501cdfa45$6b0eec80$412cc580$@kommi@huawei.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

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(at)vmware(dot)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.

Attachment Content-Type Size
pg_basebkup_recvxlog_conn_string_v1.patch application/octet-stream 12.1 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Joe Conway 2013-01-24 15:14:19 Re: PL/R Median Busts Commit (Postgres 9.1.6 + plr 8.3.0.13 on Ubuntu 12.10 64 bit)
Previous Message Andres Freund 2013-01-24 14:17:51 Re: cache lookup failed from empty plpythonu function

Browse pgsql-hackers by date

  From Date Subject
Next Message Claudio Freire 2013-01-24 15:13:53 Re: [PATCH 1/3] Fix x + y < x overflow checks
Previous Message MauMau 2013-01-24 14:53:53 Re: Back-branch update releases coming in a couple weeks