Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-09-05 Thread Victor Wagner
On Tue, 6 Sep 2016 07:58:28 +0530 Mithun Cy wrote: > > Now if only one host is in connection string and it ask for read_write > connection(connect to master) I mean read_only is set 0 explicitly. > With above logic we will allow it to connect to standby?. I still >

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-09-05 Thread Mithun Cy
On Mon, Sep 5, 2016 at 4:33 PM, Aleksander Alekseev < a.aleks...@postgrespro.ru> wrote: >After a brief examination I've found following ways to improve the patch. Adding to above comments. 1) + /* + * consult connection options and check if RO connection is OK + * RO connection is OK if readonly

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-09-05 Thread Aleksander Alekseev
Hello, Victor. > As community shows an interest with this patch, and it has been > included in the current commitfest, I've to submit it. Naturally we show interest in this patch. It's a great feature that would be very nice to have! > This version of patch includes > > 1. Most important - a

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-09-04 Thread Victor Wagner
On Mon, 5 Sep 2016 07:59:02 +0530 Mithun Cy wrote: > On Aug 31, 2016 1:44 PM, "Victor Wagner" wrote: > > Thanks, I've added this to 7-th (yet unpublished here) version of my > > patch. > Hi victor, just wanted know what your plan for your patch

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-09-04 Thread Mithun Cy
On Aug 31, 2016 1:44 PM, "Victor Wagner" wrote: > Thanks, I've added this to 7-th (yet unpublished here) version of my > patch. Hi victor, just wanted know what your plan for your patch 07. Would you like to submit it to the community. I have just signed up as a reviewer for

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-08-31 Thread Victor Wagner
On Tue, 30 Aug 2016 14:54:57 +0530 Mithun Cy wrote: > On Fri, Aug 26, 2016 at 10:10 AM, Mithun Cy > wrote: > > > > >rpath,'/home/mithun/edbsrc/patch6bin/lib',--enable-new-dtags > > >-lecpg > > -lpgtypes -lpq -lpgcommon -lpgport -lz

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-08-31 Thread Victor Wagner
On Fri, 26 Aug 2016 10:10:33 +0530 Mithun Cy wrote: > On Thu, Mar 17, 2016 at 4:47 AM, David Steele > wrote: > >Since there has been no response from the author I have marked this > >patch > "returned with feedback". Please feel free >to

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-08-30 Thread Mithun Cy
On Fri, Aug 26, 2016 at 10:10 AM, Mithun Cy wrote: > > >rpath,'/home/mithun/edbsrc/patch6bin/lib',--enable-new-dtags -lecpg > -lpgtypes -lpq -lpgcommon -lpgport -lz -lrt -lcrypt -ldl -lm -o test1 > >../../../../../src/interfaces/libpq/libpq.so: undefined reference

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-08-25 Thread Victor Wagner
On Fri, 26 Aug 2016 10:10:33 +0530 Mithun Cy wrote: > On Thu, Mar 17, 2016 at 4:47 AM, David Steele > wrote: > >Since there has been no response from the author I have marked this > >patch > "returned with feedback". Please feel free >to

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-08-25 Thread Mithun Cy
On Thu, Mar 17, 2016 at 4:47 AM, David Steele wrote: >Since there has been no response from the author I have marked this patch "returned with feedback". Please feel free >to resubmit for 9.7! I have started to work on this patch, and tried to fix some of the issues

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-03-18 Thread David Steele
On 3/10/16 7:34 AM, Simon Riggs wrote: On 9 March 2016 at 23:11, David Steele > wrote: There hasn't been any movement on this patch in a while. Will you have a new tests ready for review soon? I see the value in this feature, but the

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-03-10 Thread Simon Riggs
On 9 March 2016 at 23:11, David Steele wrote: > There hasn't been any movement on this patch in a while. Will you have a > new tests ready for review soon? > I see the value in this feature, but the patch itself needs work and probably some slimming down/reality and a

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-03-09 Thread David Steele
Hi Victor, On 2/1/16 5:05 PM, Alvaro Herrera wrote: Victor Wagner wrote: On Fri, 22 Jan 2016 16:36:15 -0300 Alvaro Herrera wrote: You're editing the expected file for the libpq-regress thingy, but you haven't added any new lines to test the new capability. I think

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-02-01 Thread Alvaro Herrera
Victor Wagner wrote: > On Fri, 22 Jan 2016 16:36:15 -0300 > Alvaro Herrera wrote: > > > You're editing the expected file for the libpq-regress thingy, but you > > haven't added any new lines to test the new capability. I think it'd > > be good to add some there. (I

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-01-24 Thread Victor Wagner
On Fri, 22 Jan 2016 16:36:15 -0300 Alvaro Herrera wrote: > You're editing the expected file for the libpq-regress thingy, but you > haven't added any new lines to test the new capability. I think it'd > be good to add some there. (I already said this earlier in the >

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-01-24 Thread Thom Brown
On 23 January 2016 at 03:32, Thom Brown wrote: > On 22 January 2016 at 19:30, Victor Wagner wrote: >> On Tue, 19 Jan 2016 14:34:54 + >> Thom Brown wrote: >> >>> >>> The segfault issue I originally reported now appears to be resolved. >>>

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-01-24 Thread Thom Brown
On 24 January 2016 at 15:30, Thom Brown wrote: > On 23 January 2016 at 03:32, Thom Brown wrote: >> On 22 January 2016 at 19:30, Victor Wagner wrote: >>> On Tue, 19 Jan 2016 14:34:54 + >>> Thom Brown wrote: >>>

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-01-24 Thread Victor Wagner
On Sun, 24 Jan 2016 15:30:22 + Thom Brown wrote: в > Okay, I've tested this again with additional logging. Again, I'm just > running "psql -p 5531 postgres", which connects to a standby. This > immediately exits psql, and the logs show: > 2016-01-24 15:04:59.886 GMT - thom

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-01-24 Thread Victor Wagner
On Sun, 24 Jan 2016 15:58:10 + Thom Brown wrote: > > Output of \set variables without patch: > > HOST = '127.0.0.1' > PORT = > '5530,127.0.0.1:5531,127.0.0.1:5532,127.0.0.1:5533,127.0.0.1:5534,127.0.0.1:5535' > > And with patch: > > HOST = >

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-01-24 Thread Thom Brown
On 24 January 2016 at 19:53, Victor Wagner wrote: > On Sun, 24 Jan 2016 15:58:10 + > Thom Brown wrote: > > >> >> Output of \set variables without patch: >> >> HOST = '127.0.0.1' >> PORT = >>

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-01-24 Thread Thom Brown
On 24 January 2016 at 20:11, Thom Brown wrote: > On 24 January 2016 at 19:53, Victor Wagner wrote: >> On Sun, 24 Jan 2016 15:58:10 + >> Thom Brown wrote: >> >> >>> >>> Output of \set variables without patch: >>> >>> HOST = '127.0.0.1' >>>

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-01-22 Thread Alvaro Herrera
You're editing the expected file for the libpq-regress thingy, but you haven't added any new lines to test the new capability. I think it'd be good to add some there. (I already said this earlier in the thread; is there any reason you ignored it the first time?) If the test program requires

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-01-22 Thread Victor Wagner
On Tue, 19 Jan 2016 14:34:54 + Thom Brown wrote: > > The segfault issue I originally reported now appears to be resolved. > > But now I have another one: > > psql >

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-01-22 Thread Thom Brown
On 22 January 2016 at 19:30, Victor Wagner wrote: > On Tue, 19 Jan 2016 14:34:54 + > Thom Brown wrote: > >> >> The segfault issue I originally reported now appears to be resolved. >> >> But now I have another one: >> >> psql >>

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-01-22 Thread Thom Brown
On 23 January 2016 at 03:32, Thom Brown wrote: > On 22 January 2016 at 19:30, Victor Wagner wrote: >> On Tue, 19 Jan 2016 14:34:54 + >> Thom Brown wrote: >> >>> >>> The segfault issue I originally reported now appears to be resolved. >>>

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-01-21 Thread Victor Wagner
On Tue, 19 Jan 2016 14:34:54 + Thom Brown wrote: > The segfault issue I originally reported now appears to be resolved. > > But now I have another one: > > psql >

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2016-01-19 Thread Thom Brown
On 21 December 2015 at 14:50, Victor Wagner wrote: > On Mon, 21 Dec 2015 17:18:37 +0300 > Teodor Sigaev wrote: > >> Sorry, but there is something wrong with your patch: >> % patch -p1 -C < ~/Downloads/libpq-failover-5.patch > > Really, somehow broken version

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-12-21 Thread Alvaro Herrera
Victor Wagner wrote: > On Mon, 21 Dec 2015 17:18:37 +0300 > Teodor Sigaev wrote: > > > Sorry, but there is something wrong with your patch: > > % patch -p1 -C < ~/Downloads/libpq-failover-5.patch > > Really, somehow broken version of the patch got into message. It would be

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-12-21 Thread Teodor Sigaev
Sorry, but there is something wrong with your patch: % patch -p1 -C < ~/Downloads/libpq-failover-5.patch -- |diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c ... Hunk #18 succeeded at 2804. patch: malformed patch at line 666:

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-12-21 Thread Victor Wagner
On Mon, 21 Dec 2015 17:18:37 +0300 Teodor Sigaev wrote: > Sorry, but there is something wrong with your patch: > % patch -p1 -C < ~/Downloads/libpq-failover-5.patch Really, somehow broken version of the patch got into message. Here is correct one. diff --git

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-12-21 Thread Michael Paquier
On Mon, Dec 21, 2015 at 11:50 PM, Victor Wagner wrote: > On Mon, 21 Dec 2015 17:18:37 +0300 > Teodor Sigaev wrote: > >> Sorry, but there is something wrong with your patch: >> % patch -p1 -C < ~/Downloads/libpq-failover-5.patch > > Really, somehow broken

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-12-09 Thread Victor Wagner
On Mon, 07 Dec 2015 15:26:33 -0500 Korry Douglas wrote: > The problem seems to be in PQconnectPoll() in the case for > CONNECTION_AUTH_OK, specifically this code: > >/* We can release the address list now. */ >pg_freeaddrinfo_all(conn->addrlist_family,

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-12-07 Thread Korry Douglas
I've tried to deal with some of these problems. My patch have support for following things: 1. Check whether database instance is in the recovery/standby mode and try to find another one if so. 2. Let cluster management software to have some time to promote one of the standbys to master. I.e.

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-12-07 Thread Korry Douglas
I've tried to deal with some of these problems. My patch have support for following things: 1. Check whether database instance is in the recovery/standby mode and try to find another one if so. 2. Let cluster management software to have some time to promote one of the standbys to master.

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-11-18 Thread Robert Haas
On Tue, Nov 17, 2015 at 3:20 PM, Peter Eisentraut wrote: > On 11/6/15 3:59 PM, Robert Haas wrote: >> So, I really wonder why we're not happy with the ability to substitute >> out just the host and IP. > > One of my concerns is that the proposed URLs are not valid URLs anymore >

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-11-17 Thread Peter Eisentraut
On 11/6/15 3:59 PM, Robert Haas wrote: > So, I really wonder why we're not happy with the ability to substitute > out just the host and IP. One of my concerns is that the proposed URLs are not valid URLs anymore that can be parsed or composed with a URL library, which would be sad. The other

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-11-17 Thread Peter Eisentraut
On 11/5/15 10:12 AM, Victor Wagner wrote: > 2. You are suggesting that it should be possible to specify all options > separately for each of the fallback hosts. I'm not necessarily suggesting that. I think it could very well be conn="postgresql://foo postgresql://bar order=random" -- Sent

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-11-09 Thread Victor Wagner
On Mon, 9 Nov 2015 15:14:02 +0800 Craig Ringer wrote: > > I'd rather not see convoluted and complex connstrings, per my prior > post. The JDBC extended URL style seems good enough. It is what my patch implements. > IMO the biggest problem is that client-side failover

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-11-08 Thread Craig Ringer
On 7 November 2015 at 04:59, Robert Haas wrote: > So, I really wonder why we're not happy with the ability to substitute > out just the host and IP. I tend to agree. That solves 95% of the problem and doesn't foreclose solving the other 5% some other way if someone really

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-11-06 Thread Alvaro Herrera
Craig Ringer wrote: > On 6 November 2015 at 13:34, Robert Haas wrote: > > >> But some options control how > >> next host should be choosen (i.e. use random order for load-balancing > >> or sequential order for high availability), so they should be specified > >> only once

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-11-06 Thread Robert Haas
On Fri, Nov 6, 2015 at 10:38 AM, Alvaro Herrera wrote: > Craig Ringer wrote: >> On 6 November 2015 at 13:34, Robert Haas wrote: >> >> >> But some options control how >> >> next host should be choosen (i.e. use random order for load-balancing >> >>

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-11-05 Thread Craig Ringer
On 6 November 2015 at 13:34, Robert Haas wrote: >> But some options control how >> next host should be choosen (i.e. use random order for load-balancing >> or sequential order for high availability), so they should be specified >> only once per connect string. > > But this

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-11-05 Thread Robert Haas
On Thu, Nov 5, 2015 at 10:12 AM, Victor Wagner wrote: > There are some drawbacks with this approach > > 1. You are suggesting usage of two nested loops, instead of one straight > loop - outer loop over the URLs in the connect string, inner loop over > the IP addresses each URL

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-11-05 Thread Victor Wagner
On 2015.11.02 at 12:15:48 -0500, Peter Eisentraut wrote: >> That's true, but doesn't allowing every parameter to be multiply >> specified greatly increase the implementation complexity for a pretty >> marginal benefit? >Well, the way I would have approached is that after all the parsing you

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-11-03 Thread Robert Haas
On Mon, Nov 2, 2015 at 12:15 PM, Peter Eisentraut wrote: > On 10/30/15 9:26 AM, Robert Haas wrote: >> That's true, but doesn't allowing every parameter to be multiply >> specified greatly increase the implementation complexity for a pretty >> marginal benefit? > > Well, the way I

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-11-02 Thread Peter Eisentraut
On 10/30/15 9:26 AM, Robert Haas wrote: > That's true, but doesn't allowing every parameter to be multiply > specified greatly increase the implementation complexity for a pretty > marginal benefit? Well, the way I would have approached is that after all the parsing you end up with a list of

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-10-30 Thread Victor Wagner
On Fri, 30 Oct 2015 14:26:45 +0100 Robert Haas wrote: > On Thu, Oct 29, 2015 at 8:29 PM, Peter Eisentraut > wrote: > > That's true, but doesn't allowing every parameter to be multiply > specified greatly increase the implementation complexity for a

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-10-30 Thread Robert Haas
On Thu, Oct 29, 2015 at 8:29 PM, Peter Eisentraut wrote: > On 10/28/15 4:18 AM, Victor Wagner wrote: >> On Mon, 26 Oct 2015 16:25:57 -0400 >> Peter Eisentraut wrote: >> >>> Also, this assumes that all the components other than host and port >>> are the same.

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-10-30 Thread Christopher Browne
On 30 October 2015 at 09:26, Robert Haas wrote: > > On Thu, Oct 29, 2015 at 8:29 PM, Peter Eisentraut wrote: > > On 10/28/15 4:18 AM, Victor Wagner wrote: > >> On Mon, 26 Oct 2015 16:25:57 -0400 > >> Peter Eisentraut wrote: > >> > >>>

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-10-30 Thread David Fetter
On Fri, Oct 30, 2015 at 11:29:09AM -0400, Christopher Browne wrote: > On 30 October 2015 at 09:26, Robert Haas wrote: > > > > On Thu, Oct 29, 2015 at 8:29 PM, Peter Eisentraut wrote: > > > On 10/28/15 4:18 AM, Victor Wagner wrote: > > >> On Mon, 26 Oct

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-10-30 Thread Josh Berkus
On 10/30/2015 08:29 AM, Christopher Browne wrote: > I think it makes the feature WORSE. I am getting more and more convinced > that the Correct Solution is for this feature to be handled by submitting > multiple URIs, and my argument isn't even based on any aspects of > implementation complexity.

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-10-29 Thread Peter Eisentraut
On 10/28/15 4:18 AM, Victor Wagner wrote: > On Mon, 26 Oct 2015 16:25:57 -0400 > Peter Eisentraut wrote: > >> Also, this assumes that all the components other than host and port >> are the same. Earlier there was a discussion about why the ports >> would ever need to be

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-10-28 Thread Victor Wagner
On Mon, 26 Oct 2015 16:25:57 -0400 Peter Eisentraut wrote: > Also, this assumes that all the components other than host and port > are the same. Earlier there was a discussion about why the ports > would ever need to be different. Well, why can't the database names > be

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-10-27 Thread Shulgin, Oleksandr
On Mon, Oct 26, 2015 at 10:02 PM, Christopher Browne wrote: > > On 26 October 2015 at 16:25, Peter Eisentraut wrote: > >> On 10/14/15 6:41 AM, Victor Wagner wrote: >> > 1. It is allowed to specify several hosts in the connect string, either >> > in URL-style

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-10-27 Thread Josh Berkus
On 10/27/2015 01:42 AM, Shulgin, Oleksandr wrote: > On Mon, Oct 26, 2015 at 10:02 PM, Christopher Browne > wrote: > > > On 26 October 2015 at 16:25, Peter Eisentraut > wrote: > > On

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-10-26 Thread Christopher Browne
On 26 October 2015 at 16:25, Peter Eisentraut wrote: > On 10/14/15 6:41 AM, Victor Wagner wrote: > > 1. It is allowed to specify several hosts in the connect string, either > > in URL-style (separated by comma) or in param=value form (several host > > parameters). > > I'm not

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-10-26 Thread Peter Eisentraut
On 10/14/15 6:41 AM, Victor Wagner wrote: > 1. It is allowed to specify several hosts in the connect string, either > in URL-style (separated by comma) or in param=value form (several host > parameters). I'm not fond of having URLs that are not valid URLs according to the applicable standards.

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-10-15 Thread Victor Wagner
On 2015.10.14 at 14:47:46 +0200, Shulgin, Oleksandr wrote: > > So what exactly would happen with this command: PGHOST=host1 psql -h host2 > > Or this one: PGHOST=host1 psql host=host2 The right thing - value of the PGHOST environment variable is ignored, and explicitely specified host is used.

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-10-15 Thread Victor Wagner
On 2015.10.15 at 17:13:46 +0800, Craig Ringer wrote: > On 14 October 2015 at 18:41, Victor Wagner wrote: > > > 5. Added new parameter readonly=boolean. If this parameter is false (the > > default) upon successful connection check is performed that backend is > > not in the

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-10-15 Thread Craig Ringer
On 14 October 2015 at 18:41, Victor Wagner wrote: > 5. Added new parameter readonly=boolean. If this parameter is false (the > default) upon successful connection check is performed that backend is > not in the recovery state. If so, connection is not considered usable > and

[HACKERS] Patch: Implement failover on libpq connect level.

2015-10-14 Thread Victor Wagner
On 2015.08.18 at 07:18:50 +0300, Victor Wagner wrote: > Rationale > = > > Since introduction of the WAL-based replication into the PostgreSQL, it is > possible to create high-availability and load-balancing clusters. > > However, there is no support for failover in the client libraries.

Re: [HACKERS] Patch: Implement failover on libpq connect level.

2015-10-14 Thread Shulgin, Oleksandr
On Wed, Oct 14, 2015 at 12:41 PM, Victor Wagner wrote: > On 2015.08.18 at 07:18:50 +0300, Victor Wagner wrote: > > > Rationale > > = > > > > Since introduction of the WAL-based replication into the PostgreSQL, it > is > > possible to create high-availability and

<    1   2