Bug 1120892 (JBJCA-1197) - [GSS] (6.3.1) prefill does not work for the last url in connection-url when HA Datasource failover is enabled
Summary: [GSS] (6.3.1) prefill does not work for the last url in connection-url when H...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: JBJCA-1197
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: JCA
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: CR1
: EAP 6.3.1
Assignee: Jesper Pedersen
QA Contact: Martin Simka
Russell Dickenson
URL:
Whiteboard:
Depends On: 1132188
Blocks: eap631-blockers, eap631-payload, eap63-cp01-blockers 1126936
TreeView+ depends on / blocked
 
Reported: 2014-07-17 22:59 UTC by Masafumi Miura
Modified: 2018-12-06 17:23 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1132188 (view as bug list)
Environment:
Last Closed: 2014-10-13 18:39:43 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker JBJCA-1197 0 Major Closed Prefill does not work for the last connection url when HA Datasource failover is enabled 2018-01-09 09:05:27 UTC
Red Hat Knowledge Base (Solution) 1139943 0 None None None Never

Internal Links: 1126936 1130385

Description Masafumi Miura 2014-07-17 22:59:56 UTC
### Description of problem:

<prefill> setting does not work for the last url in <connection-url> when HA Datasource failover is enabled.


### Steps to Reproduce:

1. Configure HA Datasource failover with enabling prefill like:
~~~
  <datasource jta="true" jndi-name="java:jboss/PostgresDS" pool-name="PostgresDS" enabled="true">
      <connection-url>jdbc:postgresql://node1:5432/jboss|jdbc:postgresql://node2:5432/jboss|jdbc:postgresql://node3:5432/jboss</connection-url>                                                                                                                                                                               
      <driver>postgresql</driver>
      <url-delimiter>|</url-delimiter>
      <pool>
          <min-pool-size>10</min-pool-size>
          <max-pool-size>10</max-pool-size>
          <prefill>true</prefill>
          <use-strict-min>true</use-strict-min>
      </pool>
      <security>
          <user-name>jboss</user-name>
          <password>redhat</password>
      </security>
      <validation>
          <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
          <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
      </validation>
  </datasource>
~~~
2. Stop node1 and node2 database instances and start node3 database instance only
3. Start JBoss EAP
4. Check the number of established connections
~~~
netstat -lantp | grep 5432
~~~

### Actual results:

Only one connection is established.


### Expected results:

<min-pool-size> connections are established.


### Additional info:

* The above example configuration is using 3 database servers but this issue also happens when using 3 database servers. 

* Here's TRACE logging at the time of issue:

~~~
TRACE [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (MSC service thread 1-10) added HA connection url: jdbc:postgresql://node1:5432/jboss                                                                                                                                                                 
TRACE [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (MSC service thread 1-10) added HA connection url: jdbc:postgresql://node2:5432/jboss
TRACE [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (MSC service thread 1-10) added HA connection url: jdbc:postgresql://node3:5432/jboss
DEBUG [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (MSC service thread 1-10) Default URLSelectorStrategy is being used : URLSelector@4873daf9[urls=[jdbc:postgresql://node1:5432/jboss, jdbc:postgresql://node2:5432/jboss, jdbc:postgresql://node3:5432/jboss] currentUrl=null currentIndex=-1]
TRACE [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (JCA PoolFiller) Using properties: {user=jboss, password=--hidden--}
TRACE [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (JCA PoolFiller) Trying to create a connection to jdbc:postgresql://node1:5432/jboss
TRACE [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (JCA PoolFiller) Checking driver for URL: jdbc:postgresql://node1:5432/jboss
TRACE [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (JCA PoolFiller) Driver not yet registered for url: jdbc:postgresql://node1:5432/jboss
DEBUG [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (JCA PoolFiller) Driver loaded and instance created:org.postgresql.Driver@4e216ca7
INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-16) JBAS010400: Bound data source [java:jboss/PostgresDS]
WARN  [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (JCA PoolFiller) Failed to create connection for jdbc:postgresql://node1:5432/jboss: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
TRACE [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (JCA PoolFiller) Trying to create a connection to jdbc:postgresql://node2:5432/jboss
WARN  [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (JCA PoolFiller) Failed to create connection for jdbc:postgresql://node2:5432/jboss: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
TRACE [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (JCA PoolFiller) Trying to create a connection to jdbc:postgresql://node3:5432/jboss
TRACE [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (JCA PoolFiller) Using properties: {user=jboss, password=--hidden--}
WARN  [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (JCA PoolFiller) IJ000610: Unable to fill pool: javax.resource.ResourceException: Could not create connection using any of the URLs: jdbc:postgresql://node1:5432/jboss, jdbc:postgresql://node2:5432/jboss, jdbc:postgresql://node3:5432/jboss
    at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getHALocalManagedConnection(LocalManagedConnectionFactory.java:341)
    at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:242)
    at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:781)
    at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.fillToMin(SemaphoreArrayListManagedConnectionPool.java:725)
    at org.jboss.jca.core.connectionmanager.pool.mcp.PoolFiller.run(PoolFiller.java:97)
    at java.lang.Thread.run(Thread.java:745)
~~~


* Workaround is putting the dummy url to the last of url list like:

~~~
  <connection-url>jdbc:postgresql://node1:5432/jboss|jdbc:postgresql://node2:5432/jboss|jdbc:postgresql://node3:5432/jboss|jdbc:postgresql://dummyhost:5432/jboss</connection-url>                                                                                                                                                                               
~~~

Comment 3 Jesper Pedersen 2014-07-18 14:22:01 UTC
Masafumi, do you want to submit pull requests against the 1.2, 1.1 and 1.0 branches ? Remember that there is an URLXASelector too in 1.1+.

Comment 10 JBoss JIRA Server 2014-07-23 14:49:25 UTC
Jesper Pedersen <jpederse> updated the status of jira JBJCA-1197 to Resolved

Comment 12 JBoss JIRA Server 2014-08-12 13:00:40 UTC
Jesper Pedersen <jpederse> updated the status of jira JBJCA-1197 to Closed

Comment 14 Martin Simka 2014-09-01 15:18:18 UTC
verified on EAP 6.3.1.CP.CR1


Note You need to log in before you can comment on or make changes to this bug.