Re: Patch: Implement failover on libpq connect level.

From: Mithun Cy <mithun(dot)cy(at)enterprisedb(dot)com>
To: David Steele <david(at)pgmasters(dot)net>, Victor Wagner <vitus(at)wagner(dot)pp(dot)ru>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Thom Brown <thom(at)linux(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch: Implement failover on libpq connect level.
Date: 2016-08-26 04:40:33
Message-ID: CAD__OugniD9nz6weXCvnEELKX2iTK3xCmVWttVjLH0k5rn_NOA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackerspgsql-jdbc

On Thu, Mar 17, 2016 at 4:47 AM, David Steele <david(at)pgmasters(dot)net> 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
discussed above. The most recent patch 06 has fixed many issues which was
raised previously which include indefinite looping, crashes. And, some of
the issues which remain pending are.

1. Connection status functions PQport, PQhost do not give corresponding
values of established connection. -- Have attached the patch for same.

2. Default value of readonly parameter is 0, which means should connect to
master only. So absence of parameter in connection string in simple cases
like "./psql -p PORT database" fails to connect to hot standby server. I
think since if readonly=1 means connect to any. and readonly=0 means
connect to master only, we should change the default value to 1, to handle
the cases when parameter is not specified.

JFYI Interestingly PostgreSql JDBC driver have following options
targetServerType=any|master|slave|preferSlave for same purpose.

Also did a little bit of patch clean-up.

Also found some minor issues related to build which I am working on.
1. make check-world @src/interfaces/ecpg/test/connect fails with following
error:
gcc -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute
-Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard
-g -O0 -pthread -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS
test1.o -L../../ecpglib -L../../pgtypeslib
-L../../../../../src/interfaces/libpq
-L../../../../../src/port -L../../../../../src/common -Wl,--as-needed
-Wl,-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 to
`pg_usleep'
collect2: error: ld returned 1 exit status
make[3]: *** [test1] Error 1
make[3]: Leaving directory `/home/mithun/mynewpost/p1/
src/interfaces/ecpg/test/connect'

patch has used pg_usleep() which is in L../../../../../src/port I think
dependency is not captured rightly.

Thanks and Regards
Mithun C Y
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
libpq-failover-07.patch text/x-patch 40.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Victor Wagner 2016-08-26 04:47:30 Re: Patch: Implement failover on libpq connect level.
Previous Message Andres Freund 2016-08-26 04:39:26 Re: increasing the default WAL segment size

Browse pgsql-jdbc by date

  From Date Subject
Next Message Victor Wagner 2016-08-26 04:47:30 Re: Patch: Implement failover on libpq connect level.
Previous Message Dave Cramer 2016-08-25 17:03:20 Re: SocketTimeout and ConnectionTimeout