Issue with seamless failover with PostGres
Our application runs on Tomcat and Postgres database. A failover testing was performed on Postgres db. Post failover, while working on the application we got the following error:
ERROR: cannot execute INSERT in a read-only transaction Call getNextException to see other errors in the batch. Problem #2, SQLState 25006, Error code 0: org.postgresql.util.PSQLException: ERROR: cannot execute INSERT in a read-only transaction Problem #3, SQLState 25006, Error code 0: org.postgresql.util.PSQLException: ERROR: cannot execute INSERT in a read-only transaction
We are using the following configuration for the Pega DB datasource:
<Resource name="jdbc/PegaRULES"
auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://xxxxxxxxxxxxxxxx:9999/xxxxx"
username="******"
password="*****"
maxActive="100"
maxIdle="30"
maxWait="10000"
/>
We have also tried the following setting:
<Resource name="jdbc/PegaRULES"
auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://xxxxxxxxxxxxxxxx:9999/xxxxx"
username="******"
password="*****"
maxActive="100"
maxIdle="30"
maxWait="10000"
validationQuery="select 1"
testOnBorrow="true"
/>
Our application runs on Tomcat and Postgres database. A failover testing was performed on Postgres db. Post failover, while working on the application we got the following error:
ERROR: cannot execute INSERT in a read-only transaction Call getNextException to see other errors in the batch. Problem #2, SQLState 25006, Error code 0: org.postgresql.util.PSQLException: ERROR: cannot execute INSERT in a read-only transaction Problem #3, SQLState 25006, Error code 0: org.postgresql.util.PSQLException: ERROR: cannot execute INSERT in a read-only transaction
We are using the following configuration for the Pega DB datasource:
<Resource name="jdbc/PegaRULES"
auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://xxxxxxxxxxxxxxxx:9999/xxxxx"
username="******"
password="*****"
maxActive="100"
maxIdle="30"
maxWait="10000"
/>
We have also tried the following setting:
<Resource name="jdbc/PegaRULES"
auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://xxxxxxxxxxxxxxxx:9999/xxxxx"
username="******"
password="*****"
maxActive="100"
maxIdle="30"
maxWait="10000"
validationQuery="select 1"
testOnBorrow="true"
/>
The error behavior is not consitent. Sometimes after 5-10 minutes, Pega is able to resolve the change in IP configuration at the database end and works fine. Other times, it is not able to determine the change endlessly and keep on hitting the secondary database instead of the primary.
A separate Java application has not faced these issues even though they are also using exactly same data source settings as well.
Has anybody else faced this issue? Any directions into which we should investigate further?.
***Edited by Moderator Marissa to update SR Details***