提交 b13d1556 authored 作者: Thomas Mueller's avatar Thomas Mueller

Issue 464: [MVStore] org.h2.mvstore.db.MVTable throws java.lang.NullPointerException

上级 ac913fb4
...@@ -23,7 +23,7 @@ Change Log ...@@ -23,7 +23,7 @@ Change Log
in a strange exception of the type "column x must be included in the group by list". in a strange exception of the type "column x must be included in the group by list".
</li><li>Issue 454: Use Charset for type-safety. </li><li>Issue 454: Use Charset for type-safety.
</li><li>Queries with both LIMIT and OFFSET could throw an IllegalArgumentException. </li><li>Queries with both LIMIT and OFFSET could throw an IllegalArgumentException.
</li><li>MVStore: multiple issues were fixed: 460, 461, 462. </li><li>MVStore: multiple issues were fixed: 460, 461, 462, 464.
</li><li>MVStore: larger stores (multiple GB) are now much faster. </li><li>MVStore: larger stores (multiple GB) are now much faster.
</li><li>When using local temporary tables and not dropping them manually before closing the session, </li><li>When using local temporary tables and not dropping them manually before closing the session,
and then killing the process could result in a database that couldn't be opened (except when using and then killing the process could result in a database that couldn't be opened (except when using
......
...@@ -642,6 +642,7 @@ public class MVTable extends TableBase { ...@@ -642,6 +642,7 @@ public class MVTable extends TableBase {
} }
primaryIndex.remove(session); primaryIndex.remove(session);
database.removeMeta(session, getId()); database.removeMeta(session, getId());
database.getMvStore().removeTable(this);
primaryIndex = null; primaryIndex = null;
close(session); close(session);
invalidate(); invalidate();
......
...@@ -101,6 +101,10 @@ public class MVTableEngine implements TableEngine { ...@@ -101,6 +101,10 @@ public class MVTableEngine implements TableEngine {
return openTables; return openTables;
} }
public void removeTable(MVTable table) {
openTables.remove(table);
}
/** /**
* Store all pending changes. * Store all pending changes.
*/ */
......
...@@ -476,6 +476,7 @@ public class ValueLob extends Value { ...@@ -476,6 +476,7 @@ public class ValueLob extends Value {
if (fileName != null) { if (fileName != null) {
if (tempFile != null) { if (tempFile != null) {
tempFile.stopAutoDelete(); tempFile.stopAutoDelete();
tempFile = null;
} }
deleteFile(handler, fileName); deleteFile(handler, fileName);
} }
......
...@@ -114,6 +114,7 @@ int test; ...@@ -114,6 +114,7 @@ int test;
Statement stat; Statement stat;
ResultSet rs; ResultSet rs;
conn = getConnection("mvstore"); conn = getConnection("mvstore");
for (int i = 0; i < 2; i++) {
stat = conn.createStatement(); stat = conn.createStatement();
stat.execute("create table test(id int primary key, name varchar) " stat.execute("create table test(id int primary key, name varchar) "
+ "engine \"org.h2.mvstore.db.MVTableEngine\""); + "engine \"org.h2.mvstore.db.MVTableEngine\"");
...@@ -135,6 +136,8 @@ int test; ...@@ -135,6 +136,8 @@ int test;
rs = stat.executeQuery("select count(*) from test"); rs = stat.executeQuery("select count(*) from test");
rs.next(); rs.next();
assertEquals(1, rs.getInt(1)); assertEquals(1, rs.getInt(1));
stat.execute("drop table test");
}
conn.close(); conn.close();
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论