jdbc targetServerType=slave with readonly connection

From: Vladimír Houba ml(dot) <vladojr(at)prosoft(dot)sk>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: jdbc targetServerType=slave with readonly connection
Date: 2018-01-16 07:47:40
Message-ID: CAP=jTS467X_Pd1yosBvevA+6gB-2YHL6UzLdhJBgBXmRrhtmzw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

Hello,

the slave replication server does not seem to be recognized correctly when
using read-only jdbc connection and targetServerType=preferSlave.

Sample conn str
<entry
key="jdbc.url.readonly">jdbc:postgresql://master,slave/up?user=***&password=***&sslmode=require&ApplicationName=***&targetServerType=preferSlave&loadBalanceHosts=true&readOnly=true</entry>

From the docs I understands that since writes are not allowed in RO
transactions, the jdbc driver thinks it is connected to a slave. I think
the master/slave check should be corrected, or configurable.

Docs:
The master/slave distinction is currently done by observing if the server
allows writes

Thank you
Vladimir

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2018-01-16 07:49:17 Re: Rangejoin rebased
Previous Message Michael Paquier 2018-01-16 07:12:11 Re: [HACKERS] Deadlock in XLogInsert at AIX

Browse pgsql-jdbc by date

  From Date Subject
Next Message Vladimir Sitnikov 2018-01-16 14:07:11 [pgjdbc/pgjdbc] eb33c4: fix: avoid NPE from getObject(..., Date.class) and...
Previous Message Dave Cramer 2018-01-15 21:55:41 [pgjdbc/pgjdbc] 32c539: prefer secondary over slave referring to standby o...