提交 53fa9ad4 authored 作者: Thomas Mueller's avatar Thomas Mueller

When the system property h2.lobInDatabase is set, the lob tables were always…

When the system property h2.lobInDatabase is set, the lob tables were always created when closing the database, even if the tables were not needed.
上级 cfcb4830
...@@ -18,7 +18,9 @@ Change Log ...@@ -18,7 +18,9 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>In the MySQL mode, SHOW TABLES didn't work, and meta data tables were not <ul><li>When the system property h2.lobInDatabase is set, the lob tables were always
created when closing the database, even if the tables were not needed.
</li><li>In the MySQL mode, SHOW TABLES didn't work, and meta data tables were not
case insensitive. Updatable result sets didn't work as expected. Issue 249. case insensitive. Updatable result sets didn't work as expected. Issue 249.
</li><li>Connection-created Clob and Blob objects can now be filled using </li><li>Connection-created Clob and Blob objects can now be filled using
Clob.setCharacterStream(1), Clob.setString(1, s), Blob.setBytes(1, x), Blob.setBinaryStream(1). Clob.setCharacterStream(1), Clob.setString(1, s), Blob.setBytes(1, x), Blob.setBinaryStream(1).
......
...@@ -443,7 +443,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>. ...@@ -443,7 +443,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>Scripting language support (Javascript). </li><li>Scripting language support (Javascript).
</li><li>The network client should better detect if the server is not an H2 server and fail early. </li><li>The network client should better detect if the server is not an H2 server and fail early.
</li><li>H2 Console: support CLOB/BLOB upload. </li><li>H2 Console: support CLOB/BLOB upload.
</li><li>Move away from system properties where possible. </li><li>Database file name suffix: a way to use no or a different suffix (for example using a slash).
</li><li>Database file lock: detect hibernate / standby / very slow threads (compare system time). </li><li>Database file lock: detect hibernate / standby / very slow threads (compare system time).
</li><li>Automatic detection of redundant indexes. </li><li>Automatic detection of redundant indexes.
</li><li>Maybe reject join without "on" (except natural join). </li><li>Maybe reject join without "on" (except natural join).
...@@ -477,7 +477,6 @@ See also <a href="build.html#providing_patches">Providing Patches</a>. ...@@ -477,7 +477,6 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>Indexes of temporary tables are currently kept in-memory. Is this how it should be? </li><li>Indexes of temporary tables are currently kept in-memory. Is this how it should be?
</li><li>The Shell tool should support the same built-in commands as the H2 Console. </li><li>The Shell tool should support the same built-in commands as the H2 Console.
</li><li>Maybe use PhantomReference instead of finalize. </li><li>Maybe use PhantomReference instead of finalize.
</li><li>Database file name suffix: a way to use no or a different suffix (for example using a slash).
</li><li>Database file name suffix: should only have one dot by default. Example: .h2db </li><li>Database file name suffix: should only have one dot by default. Example: .h2db
</li><li>Issue 196: Function based indexes </li><li>Issue 196: Function based indexes
</li><li>Fix the disk space leak (killing the process at the exact right moment will increase </li><li>Fix the disk space leak (killing the process at the exact right moment will increase
......
...@@ -199,6 +199,10 @@ public class Database implements DataHandler { ...@@ -199,6 +199,10 @@ public class Database implements DataHandler {
listener = StringUtils.trim(listener, true, true, "'"); listener = StringUtils.trim(listener, true, true, "'");
setEventListenerClass(listener); setEventListenerClass(listener);
} }
String modeName = ci.removeProperty("MODE", null);
if (modeName != null) {
this.mode = Mode.getInstance(modeName);
}
this.multiVersion = ci.getProperty("MVCC", false); this.multiVersion = ci.getProperty("MVCC", false);
boolean closeAtVmShutdown = dbSettings.dbCloseOnExit; boolean closeAtVmShutdown = dbSettings.dbCloseOnExit;
int traceLevelFile = ci.getIntProperty(SetTypes.TRACE_LEVEL_FILE, TraceSystem.DEFAULT_TRACE_LEVEL_FILE); int traceLevelFile = ci.getIntProperty(SetTypes.TRACE_LEVEL_FILE, TraceSystem.DEFAULT_TRACE_LEVEL_FILE);
...@@ -1053,11 +1057,14 @@ public class Database implements DataHandler { ...@@ -1053,11 +1057,14 @@ public class Database implements DataHandler {
} }
// remove all session variables // remove all session variables
if (persistent) { if (persistent) {
try { boolean lobStorageIsUsed = infoSchema.findTableOrView(systemSession, LobStorage.LOB_DATA_TABLE) != null;
getLobStorage(); if (lobStorageIsUsed) {
lobStorage.removeAllForTable(LobStorage.TABLE_ID_SESSION_VARIABLE); try {
} catch (DbException e) { getLobStorage();
traceSystem.getTrace(Trace.DATABASE).error("close", e); lobStorage.removeAllForTable(LobStorage.TABLE_ID_SESSION_VARIABLE);
} catch (DbException e) {
traceSystem.getTrace(Trace.DATABASE).error("close", e);
}
} }
} }
tempFileDeleter.deleteAll(); tempFileDeleter.deleteAll();
......
...@@ -44,10 +44,16 @@ public class LobStorage { ...@@ -44,10 +44,16 @@ public class LobStorage {
*/ */
public static final int TABLE_TEMP = -2; public static final int TABLE_TEMP = -2;
/**
* The name of the lob data table. If this table exists, then lob storage is used.
*/
public static final String LOB_DATA_TABLE = "LOB_DATA";
private static final String LOB_SCHEMA = "INFORMATION_SCHEMA";
private static final String LOBS = "INFORMATION_SCHEMA.LOBS"; private static final String LOBS = LOB_SCHEMA + ".LOBS";
private static final String LOB_MAP = "INFORMATION_SCHEMA.LOB_MAP"; private static final String LOB_MAP = LOB_SCHEMA + ".LOB_MAP";
private static final String LOB_DATA = "INFORMATION_SCHEMA.LOB_DATA"; private static final String LOB_DATA = LOB_SCHEMA + "." + LOB_DATA_TABLE;
private static final int BLOCK_LENGTH = 20000; private static final int BLOCK_LENGTH = 20000;
......
...@@ -881,7 +881,7 @@ public abstract class TestBase { ...@@ -881,7 +881,7 @@ public abstract class TestBase {
String actual = rs.getString(1); String actual = rs.getString(1);
assertEquals(expected, actual); assertEquals(expected, actual);
} else { } else {
assertEquals(null, expected); assertEquals(expected, null);
} }
} }
......
...@@ -2483,10 +2483,10 @@ create table address(id identity, name varchar check instr(value, '@') > 1); ...@@ -2483,10 +2483,10 @@ create table address(id identity, name varchar check instr(value, '@') > 1);
create table address(id identity, name varchar check instr(name, '@') > 1); create table address(id identity, name varchar check instr(name, '@') > 1);
> ok > ok
drop table address; drop view if exists address_view;
> ok > ok
drop view if exists address_view; drop table address;
> ok > ok
create memory table a(k10 blob(10k), m20 blob(20m), g30 clob(30g)); create memory table a(k10 blob(10k), m20 blob(20m), g30 clob(30g));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论