提交 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
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>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>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
......
......@@ -642,6 +642,7 @@ public class MVTable extends TableBase {
}
primaryIndex.remove(session);
database.removeMeta(session, getId());
database.getMvStore().removeTable(this);
primaryIndex = null;
close(session);
invalidate();
......
......@@ -100,6 +100,10 @@ public class MVTableEngine implements TableEngine {
public List<MVTable> getTables() {
return openTables;
}
public void removeTable(MVTable table) {
openTables.remove(table);
}
/**
* Store all pending changes.
......
......@@ -476,6 +476,7 @@ public class ValueLob extends Value {
if (fileName != null) {
if (tempFile != null) {
tempFile.stopAutoDelete();
tempFile = null;
}
deleteFile(handler, fileName);
}
......
......@@ -114,27 +114,30 @@ int test;
Statement stat;
ResultSet rs;
conn = getConnection("mvstore");
stat = conn.createStatement();
stat.execute("create table test(id int primary key, name varchar) "
+ "engine \"org.h2.mvstore.db.MVTableEngine\"");
conn.setAutoCommit(false);
stat.execute("insert into test values(1, 'Hello')");
stat.execute("insert into test values(2, 'World')");
rs = stat.executeQuery("select count(*) from test");
rs.next();
assertEquals(2, rs.getInt(1));
conn.rollback();
rs = stat.executeQuery("select count(*) from test");
rs.next();
assertEquals(0, rs.getInt(1));
stat.execute("insert into test values(1, 'Hello')");
Savepoint sp = conn.setSavepoint();
stat.execute("insert into test values(2, 'World')");
conn.rollback(sp);
rs = stat.executeQuery("select count(*) from test");
rs.next();
assertEquals(1, rs.getInt(1));
for (int i = 0; i < 2; i++) {
stat = conn.createStatement();
stat.execute("create table test(id int primary key, name varchar) "
+ "engine \"org.h2.mvstore.db.MVTableEngine\"");
conn.setAutoCommit(false);
stat.execute("insert into test values(1, 'Hello')");
stat.execute("insert into test values(2, 'World')");
rs = stat.executeQuery("select count(*) from test");
rs.next();
assertEquals(2, rs.getInt(1));
conn.rollback();
rs = stat.executeQuery("select count(*) from test");
rs.next();
assertEquals(0, rs.getInt(1));
stat.execute("insert into test values(1, 'Hello')");
Savepoint sp = conn.setSavepoint();
stat.execute("insert into test values(2, 'World')");
conn.rollback(sp);
rs = stat.executeQuery("select count(*) from test");
rs.next();
assertEquals(1, rs.getInt(1));
stat.execute("drop table test");
}
conn.close();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论