提交 5b3b1050 authored 作者: Thomas Mueller's avatar Thomas Mueller

New system property h2.lobClientMaxSizeMemory to set the maximum size of a LOB…

New system property h2.lobClientMaxSizeMemory to set the maximum size of a LOB object to keep in memory on the client side when using the server mode.
上级 c26dc504
...@@ -342,6 +342,13 @@ public class SysProperties { ...@@ -342,6 +342,13 @@ public class SysProperties {
*/ */
public static final boolean LOB_IN_DATABASE = getBooleanSetting("h2.lobInDatabase", false); public static final boolean LOB_IN_DATABASE = getBooleanSetting("h2.lobInDatabase", false);
/**
* System property <code>h2.lobClientMaxSizeMemory</code> (default: 65536).<br />
* The maximum size of a LOB object to keep in memory on the client side
* when using the server mode.
*/
public static final int LOB_CLIENT_MAX_SIZE_MEMORY = getIntSetting("h2.lobClientMaxSizeMemory", 65536);
/** /**
* System property <code>h2.logAllErrors</code> (default: false).<br /> * System property <code>h2.logAllErrors</code> (default: false).<br />
* Write stack traces of any kind of error to a file. * Write stack traces of any kind of error to a file.
...@@ -633,8 +640,8 @@ public class SysProperties { ...@@ -633,8 +640,8 @@ public class SysProperties {
/** /**
* System property <code>h2.sortNullsHigh</code> (default: false).<br /> * System property <code>h2.sortNullsHigh</code> (default: false).<br />
* Invert the default sorting behavior for NULL values, such that NULL * Invert the default sorting behavior for NULL, such that NULL
* values are sorted to the end of a result set in an ascending sort and to * is at the end of a result set in an ascending sort and at
* the beginning of a result set in a descending sort. * the beginning of a result set in a descending sort.
*/ */
public static final boolean SORT_NULLS_HIGH = getBooleanSetting("h2.sortNullsHigh", false); public static final boolean SORT_NULLS_HIGH = getBooleanSetting("h2.sortNullsHigh", false);
......
...@@ -133,12 +133,6 @@ public class Constants { ...@@ -133,12 +133,6 @@ public class Constants {
*/ */
public static final long DEFAULT_MAX_LOG_SIZE = 16 * 1024 * 1024; public static final long DEFAULT_MAX_LOG_SIZE = 16 * 1024 * 1024;
/**
* The default maximum length on an in-memory LOB object.
* Larger objects will be written to a temporary file.
*/
public static final int DEFAULT_MAX_LENGTH_CLIENTSIDE_LOB = 65536;
/** /**
* The default maximum number of rows to be kept in memory in a result set. * The default maximum number of rows to be kept in memory in a result set.
*/ */
......
...@@ -37,7 +37,7 @@ import org.h2.value.Transfer; ...@@ -37,7 +37,7 @@ import org.h2.value.Transfer;
* The client side part of a session when using the server mode. This object * The client side part of a session when using the server mode. This object
* communicates with a Session on the server side. * communicates with a Session on the server side.
*/ */
public class SessionRemote extends SessionWithState implements SessionFactory, DataHandler { public class SessionRemote extends SessionWithState implements DataHandler {
public static final int SESSION_PREPARE = 0; public static final int SESSION_PREPARE = 0;
public static final int SESSION_CLOSE = 1; public static final int SESSION_CLOSE = 1;
...@@ -60,6 +60,8 @@ public class SessionRemote extends SessionWithState implements SessionFactory, D ...@@ -60,6 +60,8 @@ public class SessionRemote extends SessionWithState implements SessionFactory, D
public static final int STATUS_CLOSED = 2; public static final int STATUS_CLOSED = 2;
public static final int STATUS_OK_STATE_CHANGED = 3; public static final int STATUS_OK_STATE_CHANGED = 3;
private static SessionFactory sessionFactory;
private TraceSystem traceSystem; private TraceSystem traceSystem;
private Trace trace; private Trace trace;
private ArrayList<Transfer> transferList = New.arrayList(); private ArrayList<Transfer> transferList = New.arrayList();
...@@ -80,11 +82,7 @@ public class SessionRemote extends SessionWithState implements SessionFactory, D ...@@ -80,11 +82,7 @@ public class SessionRemote extends SessionWithState implements SessionFactory, D
private LobStorage lobStorage; private LobStorage lobStorage;
private boolean cluster; private boolean cluster;
public SessionRemote() { public SessionRemote(ConnectionInfo ci) {
// nothing to do
}
private SessionRemote(ConnectionInfo ci) {
this.connectionInfo = ci; this.connectionInfo = ci;
} }
...@@ -229,11 +227,13 @@ public class SessionRemote extends SessionWithState implements SessionFactory, D ...@@ -229,11 +227,13 @@ public class SessionRemote extends SessionWithState implements SessionFactory, D
backup = (ConnectionInfo) ci.clone(); backup = (ConnectionInfo) ci.clone();
connectionInfo = (ConnectionInfo) ci.clone(); connectionInfo = (ConnectionInfo) ci.clone();
} }
SessionFactory sf = (SessionFactory) Class.forName("org.h2.engine.Session").newInstance();
if (openNew) { if (openNew) {
ci.setProperty("OPEN_NEW", "true"); ci.setProperty("OPEN_NEW", "true");
} }
return sf.createSession(ci); if (sessionFactory == null) {
sessionFactory = (SessionFactory) Class.forName("org.h2.engine.Engine").newInstance();
}
return sessionFactory.createSession(ci);
} catch (Exception re) { } catch (Exception re) {
DbException e = DbException.convert(re); DbException e = DbException.convert(re);
if (e.getErrorCode() == ErrorCode.DATABASE_ALREADY_OPEN_1) { if (e.getErrorCode() == ErrorCode.DATABASE_ALREADY_OPEN_1) {
...@@ -551,7 +551,7 @@ public class SessionRemote extends SessionWithState implements SessionFactory, D ...@@ -551,7 +551,7 @@ public class SessionRemote extends SessionWithState implements SessionFactory, D
} }
public int getMaxLengthInplaceLob() { public int getMaxLengthInplaceLob() {
return Constants.DEFAULT_MAX_LENGTH_CLIENTSIDE_LOB; return SysProperties.LOB_CLIENT_MAX_SIZE_MEMORY;
} }
public FileStore openFile(String name, String mode, boolean mustExist) { public FileStore openFile(String name, String mode, boolean mustExist) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论