aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-core
diff options
context:
space:
mode:
authorJacek <jacek.poreda@sonarsource.com>2022-08-30 09:23:41 +0200
committersonartech <sonartech@sonarsource.com>2022-08-30 20:03:14 +0000
commit53bd09356728835b4b4aad5508df94d0da4c5012 (patch)
tree00ea8277759347baf5822d02e67772e68c10c400 /server/sonar-db-core
parent70fd6789e58e19d3e5ab5e71b67444b57f8940d3 (diff)
downloadsonarqube-53bd09356728835b4b4aad5508df94d0da4c5012.tar.gz
sonarqube-53bd09356728835b4b4aad5508df94d0da4c5012.zip
SONAR-17200 Ignore unused sonar.jdbc.* properties for HikariCP
Diffstat (limited to 'server/sonar-db-core')
-rw-r--r--server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java24
1 files changed, 18 insertions, 6 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);
}