提交 58c1f264 authored 作者: Thomas Mueller's avatar Thomas Mueller

Large result sets now always create temporary tables instead of temporary files.

上级 2b0e00a1
......@@ -191,8 +191,8 @@ public class SelectUnion extends Query {
default:
DbException.throwInternalError("type=" + unionType);
}
ResultInterface l = left.query(0);
ResultInterface r = right.query(0);
LocalResult l = left.query(0);
LocalResult r = right.query(0);
l.reset();
r.reset();
switch (unionType) {
......@@ -242,6 +242,8 @@ public class SelectUnion extends Query {
result.setLimit(v.getInt());
}
}
l.close();
r.close();
result.done();
if (target != null) {
while (result.next()) {
......
......@@ -711,6 +711,8 @@ public class MVTable extends TableBase {
if (index.getName() != null) {
database.removeSchemaObject(session, index);
}
// needed for session temporary indexes
indexes.remove(index);
}
if (SysProperties.CHECK) {
for (SchemaObject obj : database.getAllSchemaObjects(DbObject.INDEX)) {
......
......@@ -762,10 +762,6 @@ public class TransactionStore {
* Commit the transaction. Afterwards, this transaction is closed.
*/
public void commit() {
if (status == STATUS_CLOSED) {
// TODO analyze why this happens
return;
}
checkNotClosed();
store.commit(this, logId);
}
......
......@@ -114,7 +114,6 @@ public class ResultTempTable implements ResultExternal {
IndexType indexType = IndexType.createNonUnique(true);
index = table.addIndex(session, indexName, indexId, indexCols,
indexType, true, null);
index.setTemporary(true);
}
@Override
......@@ -221,12 +220,21 @@ public class ResultTempTable implements ResultExternal {
// time. (the table is truncated, so this is just one record)
if (!database.isSysTableLocked()) {
Session sysSession = database.getSystemSession();
table.removeChildrenAndResources(sysSession);
if (index != null) {
index.removeChildrenAndResources(sysSession);
// need to explicitly do this,
// as it's not registered in the system session
session.removeLocalTempTableIndex(index);
}
table.removeChildrenAndResources(sysSession);
// the transaction must be committed immediately
sysSession.commit(false);
// TODO this synchronization cascade is very ugly
synchronized (session) {
synchronized (database) {
synchronized (sysSession) {
sysSession.commit(false);
}
}
}
}
} finally {
table = null;
......
......@@ -700,6 +700,8 @@ public class RegularTable extends TableBase {
if (index.getName() != null) {
database.removeSchemaObject(session, index);
}
// needed for session temporary indexes
indexes.remove(index);
}
if (SysProperties.CHECK) {
for (SchemaObject obj : database.getAllSchemaObjects(DbObject.INDEX)) {
......
......@@ -386,13 +386,7 @@ java org.h2.test.TestAll timer
// use lower values, to better test those cases,
// and to speed up the tests (for delays)
; // TEST
// System.setProperty("h2.maxMemoryRows", "2");
System.setProperty("h2.maxMemoryRows", "10");
// System.setProperty("h2.maxMemoryRows", "1000");
// System.setProperty("h2.maxMemoryRows", "2");
System.setProperty("h2.maxMemoryRows", "100");
System.setProperty("h2.check2", "true");
System.setProperty("h2.delayWrongPasswordMin", "0");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论