Fixed user defined JDBC URL override not working. (#1499)

Fixes logic error in the way a user defined `jdbcUrl` in
`hikaricp.properties` is handled.

Additionally changed the default max pool size to the previous limit of
90 connections. PR #926 originally also had this but this apparantly
fell out. Testing showed that during first time server startup a flood
of connection can be made and a connection pool of 30 can be
overwhelmed and callers waiting on a connection will time-out.
This commit is contained in:
Jasper Siepkes 2022-09-26 09:45:05 +02:00 committed by GitHub
parent 08c1727c60
commit 0173bbd296
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 10 deletions

View File

@ -52,7 +52,7 @@ connectionTimeout=60000
# will block for up to connectionTimeout milliseconds before timing out. Please # will block for up to connectionTimeout milliseconds before timing out. Please
# read about pool sizing: https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing # read about pool sizing: https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing
# Default: 10 # Default: 10
maximumPoolSize=30 maximumPoolSize=90
# This property controls the maximum lifetime of a connection in the pool. An # This property controls the maximum lifetime of a connection in the pool. An
# in-use connection will never be retired, only when it is closed will it then be # in-use connection will never be retired, only when it is closed will it then be
@ -69,4 +69,4 @@ maximumPoolSize=30
# pool before a message is logged indicating a possible connection leak. A value of 0 # pool before a message is logged indicating a possible connection leak. A value of 0
# means leak detection is disabled. Lowest acceptable value for enabling leak detection # means leak detection is disabled. Lowest acceptable value for enabling leak detection
# is 2000 (2 seconds). Default: 0 # is 2000 (2 seconds). Default: 0
leakDetectionThreshold=300000 leakDetectionThreshold=300000

View File

@ -721,13 +721,13 @@ public class DB_Oracle implements AdempiereDatabase
Properties poolProperties = getPoolProperties(); Properties poolProperties = getPoolProperties();
// Do not override values which might have been read from the users // Do not override values which might have been read from the users
// hikaricp.properties file. // hikaricp.properties file.
if(!poolProperties.contains("jdbcUrl")) { if(!poolProperties.containsKey("jdbcUrl")) {
poolProperties.put("jdbcUrl", getConnectionURL(connection)); poolProperties.put("jdbcUrl", getConnectionURL(connection));
} }
if (!poolProperties.contains("username")) { if (!poolProperties.containsKey("username")) {
poolProperties.put("username", connection.getDbUid()); poolProperties.put("username", connection.getDbUid());
} }
if (!poolProperties.contains("password")) { if (!poolProperties.containsKey("password")) {
poolProperties.put("password", connection.getDbPwd()); poolProperties.put("password", connection.getDbPwd());
} }

View File

@ -52,7 +52,7 @@ connectionTimeout=60000
# will block for up to connectionTimeout milliseconds before timing out. Please # will block for up to connectionTimeout milliseconds before timing out. Please
# read about pool sizing: https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing # read about pool sizing: https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing
# Default: 10 # Default: 10
maximumPoolSize=30 maximumPoolSize=90
# This property controls the maximum lifetime of a connection in the pool. An # This property controls the maximum lifetime of a connection in the pool. An
# in-use connection will never be retired, only when it is closed will it then be # in-use connection will never be retired, only when it is closed will it then be
@ -69,4 +69,4 @@ maximumPoolSize=30
# pool before a message is logged indicating a possible connection leak. A value of 0 # pool before a message is logged indicating a possible connection leak. A value of 0
# means leak detection is disabled. Lowest acceptable value for enabling leak detection # means leak detection is disabled. Lowest acceptable value for enabling leak detection
# is 2000 (2 seconds). Default: 0 # is 2000 (2 seconds). Default: 0
leakDetectionThreshold=300000 leakDetectionThreshold=300000

View File

@ -747,13 +747,13 @@ public class DB_PostgreSQL implements AdempiereDatabase
Properties poolProperties = getPoolProperties(); Properties poolProperties = getPoolProperties();
// Do not override values which might have been read from the users // Do not override values which might have been read from the users
// hikaricp.properties file. // hikaricp.properties file.
if(!poolProperties.contains("jdbcUrl")) { if(!poolProperties.containsKey("jdbcUrl")) {
poolProperties.put("jdbcUrl", getConnectionURL(connection)); poolProperties.put("jdbcUrl", getConnectionURL(connection));
} }
if (!poolProperties.contains("username")) { if (!poolProperties.containsKey("username")) {
poolProperties.put("username", connection.getDbUid()); poolProperties.put("username", connection.getDbUid());
} }
if (!poolProperties.contains("password")) { if (!poolProperties.containsKey("password")) {
poolProperties.put("password", connection.getDbPwd()); poolProperties.put("password", connection.getDbPwd());
} }