stream result sets row-by-row on MySQL/MariaDB

This commit is contained in:
Ralf Wisser
2020-02-27 12:57:29 +01:00
parent 49f45926a1
commit f96b49c753
3 changed files with 12 additions and 8 deletions
@@ -390,7 +390,7 @@ union all
<value>true</value>
</entry>
</jdbcProperties>
<!-- <fetchSize>-2147483648</fetchSize> --> <!-- setFetchSize(Integer.MIN_VALUE) should enable result set streaming -->
<fetchSize>-2147483648</fetchSize> <!-- setFetchSize(Integer.MIN_VALUE) enables result set streaming -->
<statisticRenovator>
<scriptFileName>script/mysql/update_statistics.sql</scriptFileName>
</statisticRenovator>
@@ -597,7 +597,7 @@ union all
<value>true</value>
</entry>
</jdbcProperties>
<!-- <fetchSize>-2147483648</fetchSize> --> <!-- setFetchSize(Integer.MIN_VALUE) should enable result set streaming -->
<fetchSize>4096</fetchSize>
<statisticRenovator>
<scriptFileName>script/mysql/update_statistics.sql</scriptFileName>
</statisticRenovator>
@@ -1282,7 +1282,7 @@ Select CNAME, TNAME, COLNAME, CTYPE, DETAIL From
</entry>
</typeReplacement>
<sqlLimitSuffix>LIMIT %s</sqlLimitSuffix>
<fetchSize>1000</fetchSize>
<fetchSize>4096</fetchSize>
<!-- NOLOGGING, TABLESPACE-spec., etc. -->
<tableProperties>CREATE UNLOGGED TABLE</tableProperties>
@@ -1434,7 +1434,7 @@ union all
</entry>
</typeReplacement>
<sqlLimitSuffix>LIMIT %s</sqlLimitSuffix>
<fetchSize>1000</fetchSize>
<fetchSize>4096</fetchSize>
<!-- NOLOGGING, TABLESPACE-spec., etc. -->
<tableProperties>CREATE UNLOGGED TABLE</tableProperties>
@@ -522,7 +522,11 @@ public class Session {
statement = theConnection.createStatement();
if (dbms != null) {
if (dbms.getFetchSize() != null) {
statement.setFetchSize(dbms.getFetchSize());
try {
statement.setFetchSize(dbms.getFetchSize());
} catch (Throwable t) {
// ignore
}
}
}
CancellationHandler.begin(statement, context);
@@ -98,7 +98,7 @@ public class JobManager {
incrementJobsInExecutionCounter();
job.run();
incrementJobsDoneCounter();
} catch (Exception e) {
} catch (Throwable e) {
setException(e);
} finally {
decrementJobsInExecutionCounter();
@@ -277,8 +277,8 @@ public class JobManager {
/**
* Sets an exception.
*/
private synchronized void setException(Exception e) {
exception = e == null? null : (e instanceof CancellationException || e instanceof SQLException)? e
private synchronized void setException(Throwable e) {
exception = e == null? null : (e instanceof CancellationException || e instanceof SQLException)? (Exception) e
: new RuntimeException(Thread.currentThread().getName() + " failed", e);
jobs = null;
}