From 1c02166d29fe47296de2ec2df2e0ca6301f16f7a Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Thu, 9 May 2024 21:08:47 +0530 Subject: [PATCH] framework/db: dont' use validation query as connector is JDBC4 compliant Per docs, if the mysql connector is JDBC2 compliant then it should use the Connection.isValid API to test a connection. (https://docs.oracle.com/javase/8/docs/api/java/sql/Connection.html#isValid-int-) This would significantly reduce query lags and API throughput, as for every SQL query one or two SELECT 1 are performed everytime a Connection is given to application logic. This should only be accepted when the driver is JDBC4 complaint. Signed-off-by: Rohit Yadav --- .../db/src/main/java/com/cloud/utils/db/TransactionLegacy.java | 3 --- pom.xml | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/framework/db/src/main/java/com/cloud/utils/db/TransactionLegacy.java b/framework/db/src/main/java/com/cloud/utils/db/TransactionLegacy.java index f787592df5f..e22297d1584 100644 --- a/framework/db/src/main/java/com/cloud/utils/db/TransactionLegacy.java +++ b/framework/db/src/main/java/com/cloud/utils/db/TransactionLegacy.java @@ -1158,9 +1158,6 @@ public class TransactionLegacy implements Closeable { GenericObjectPoolConfig config = createPoolConfig(maxActive, maxIdle, maxWait, timeBtwnEvictionRuns, minEvictableIdleTime, testWhileIdle, testOnBorrow); ObjectPool connectionPool = new GenericObjectPool<>(poolableConnectionFactory, config); poolableConnectionFactory.setPool(connectionPool); - if (validationQuery != null) { - poolableConnectionFactory.setValidationQuery(validationQuery); - } if (isolationLevel != null) { poolableConnectionFactory.setDefaultTransactionIsolation(isolationLevel); } diff --git a/pom.xml b/pom.xml index adfdd153d3e..ec99cabd513 100644 --- a/pom.xml +++ b/pom.xml @@ -100,7 +100,7 @@ 1.6 1.10 1.3.3 - 2.9.0 + 2.12.0 0.5 2.6 2.9.0