diff options
author | Jacek <jacek.poreda@sonarsource.com> | 2022-08-30 09:23:41 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-08-30 20:03:14 +0000 |
commit | 53bd09356728835b4b4aad5508df94d0da4c5012 (patch) | |
tree | 00ea8277759347baf5822d02e67772e68c10c400 | |
parent | 70fd6789e58e19d3e5ab5e71b67444b57f8940d3 (diff) | |
download | sonarqube-53bd09356728835b4b4aad5508df94d0da4c5012.tar.gz sonarqube-53bd09356728835b4b4aad5508df94d0da4c5012.zip |
SONAR-17200 Ignore unused sonar.jdbc.* properties for HikariCP
-rw-r--r-- | server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java | 24 | ||||
-rw-r--r-- | sonar-application/src/main/assembly/conf/sonar.properties | 5 |
2 files changed, 18 insertions, 11 deletions
diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java b/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java index 837b941f445..0b1bd78451c 100644 --- a/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java +++ b/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java @@ -43,7 +43,6 @@ import org.sonar.process.logging.LogbackHelper; import static com.google.common.base.Preconditions.checkState; import static java.lang.String.format; -import static org.sonar.process.ProcessProperties.Property.JDBC_DRIVER_PATH; import static org.sonar.process.ProcessProperties.Property.JDBC_EMBEDDED_PORT; import static org.sonar.process.ProcessProperties.Property.JDBC_MIN_IDLE; import static org.sonar.process.ProcessProperties.Property.JDBC_PASSWORD; @@ -68,10 +67,23 @@ public class DefaultDatabase implements Database { "sonar.jdbc.minEvictableIdleTimeMillis", "sonar.jdbc.timeBetweenEvictionRunsMillis"); - private static final Set<String> IGNORED_SONAR_PROPERTIES = Set.of(SONAR_JDBC_DIALECT, JDBC_DRIVER_PATH.getKey(), - "sonar.jdbc.maxIdle", - "sonar.jdbc.minEvictableIdleTimeMillis", - "sonar.jdbc.timeBetweenEvictionRunsMillis"); + private static final Set<String> ALLOWED_SONAR_PROPERTIES = Set.of( + JDBC_USERNAME.getKey(), + JDBC_PASSWORD.getKey(), + JDBC_EMBEDDED_PORT.getKey(), + JDBC_URL.getKey(), + JDBC_MIN_IDLE.getKey(), + SONAR_JDBC_MAX_WAIT, + SONAR_JDBC_MAX_ACTIVE, + // allowed hikari cp direct properties + SONAR_JDBC_DRIVER, + "sonar.jdbc.dataSource.user", + "sonar.jdbc.dataSource.password", + "sonar.jdbc.dataSource.portNumber", + "sonar.jdbc.jdbcUrl", + "sonar.jdbc.connectionTimeout", + "sonar.jdbc.maximumPoolSize", + "sonar.jdbc.minimumIdle"); private static final Map<String, String> SONAR_JDBC_TO_HIKARI_PROPERTY_MAPPINGS = Map.of( JDBC_USERNAME.getKey(), "dataSource.user", @@ -195,7 +207,7 @@ public class DefaultDatabase implements Database { Properties result = new Properties(); for (Map.Entry<Object, Object> entry : properties.entrySet()) { String key = (String) entry.getKey(); - if (IGNORED_SONAR_PROPERTIES.contains(key)) { + if (!ALLOWED_SONAR_PROPERTIES.contains(key)) { if (DEPRECATED_SONAR_PROPERTIES.contains(key)) { LOG.warn("Property [{}] has no effect as pool connection implementation changed, check 9.7 upgrade notes.", key); } diff --git a/sonar-application/src/main/assembly/conf/sonar.properties b/sonar-application/src/main/assembly/conf/sonar.properties index d24fd2dc23a..fc3c22b91ef 100644 --- a/sonar-application/src/main/assembly/conf/sonar.properties +++ b/sonar-application/src/main/assembly/conf/sonar.properties @@ -58,10 +58,6 @@ # then sonar.jdbc.maxActive should be 1.2 * 50 = 60. #sonar.jdbc.maxActive=60 -# The maximum number of connections that can remain idle in the -# pool, without extra ones being released, or negative for no limit. -#sonar.jdbc.maxIdle=5 - # The minimum number of connections that can remain idle in the pool, # without extra ones being created, or zero to create none. #sonar.jdbc.minIdle=10 @@ -72,7 +68,6 @@ #sonar.jdbc.maxWait=8000 - #-------------------------------------------------------------------------------------------------- # WEB SERVER # Web server is executed in a dedicated Java process. By default heap size is @webDefaultHeapSize@. |