]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5605 MySQL: configure driver to use server side cursor and not client side...
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Fri, 10 Oct 2014 06:59:32 +0000 (08:59 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Fri, 10 Oct 2014 08:23:33 +0000 (10:23 +0200)
server/sonar-server/src/main/java/org/sonar/server/db/migrations/SelectImpl.java
sonar-application/src/main/assembly/conf/sonar.properties
sonar-application/src/main/java/org/sonar/application/JdbcSettings.java
sonar-application/src/test/java/org/sonar/application/JdbcSettingsTest.java

index b49fc88edee07aba640a4af55da644521cd3bd64..d0724aaa8138ac7389eb07a4f30d0dc2ffb07855 100644 (file)
@@ -21,7 +21,6 @@ package org.sonar.server.db.migrations;
 
 import org.apache.commons.dbutils.DbUtils;
 import org.sonar.core.persistence.Database;
-import org.sonar.core.persistence.dialect.MySql;
 
 import java.sql.Connection;
 import java.sql.PreparedStatement;
@@ -83,11 +82,7 @@ class SelectImpl extends BaseSqlStatement<Select> implements Select {
 
   static SelectImpl create(Database db, Connection connection, String sql) throws SQLException {
     PreparedStatement pstmt = connection.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
-    if (db.getDialect().getId().equals(MySql.ID)) {
-      pstmt.setFetchSize(Integer.MIN_VALUE);
-    } else {
-      pstmt.setFetchSize(1000);
-    }
+    pstmt.setFetchSize(1000);
     return new SelectImpl(pstmt);
   }
 }
index e3477959f1b2cc33c95ec061c52d9763852ff902..0c70358e1c142e5af3c880502277d6ddbe87227f 100644 (file)
@@ -28,7 +28,7 @@
 
 
 #----- MySQL 5.x
-#sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
+#sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useCursorFetch=true
 
 
 #----- Oracle 10g/11g
index 20e32cacd02b25ff12ebaec62f3f763ef20161c3..2ce07111978b87010a5b650d8c6196a2d1b87d3d 100644 (file)
@@ -98,6 +98,7 @@ public class JdbcSettings {
     if (Provider.mysql.equals(provider)) {
       checkRequiredParameter(url, "useUnicode=true");
       checkRequiredParameter(url, "characterEncoding=utf8");
+      checkRequiredParameter(url, "useCursorFetch=true");
       checkRecommendedParameter(url, "rewriteBatchedStatements=true");
       checkRecommendedParameter(url, "useConfigs=maxPerformance");
     }
index ad603c4e45357e1382281296ae0870870d0ab84b..e1cdeffa94e62380a9327b7a58d0c532e4bf54e6 100644 (file)
@@ -64,11 +64,11 @@ public class JdbcSettingsTest {
 
     // minimal -> ok
     settings.checkUrlParameters(JdbcSettings.Provider.mysql,
-      "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8");
+      "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&useCursorFetch=true");
 
     // full -> ok
     settings.checkUrlParameters(JdbcSettings.Provider.mysql,
-      "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance");
+      "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useCursorFetch=true");
 
     // missing required -> ko
     try {