### 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> ~~~
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+.
Jesper Pedersen <jpederse> updated the status of jira JBJCA-1197 to Resolved
Jesper Pedersen <jpederse> updated the status of jira JBJCA-1197 to Closed
verified on EAP 6.3.1.CP.CR1