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

Large transactions could run out of heap space. Fixed.

上级 d20a867e
......@@ -18,7 +18,9 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>Creating a database was delayed about 2 seconds if the directory didn't exist.
<ul><li>Large transactions could run out of heap space. Fixed.
</li><li>The default setting for the system property h2.webMaxValueLength is now 100000 (it was 10000 before).
</li><li>Creating a database was delayed about 2 seconds if the directory didn't exist.
</li></ul>
<h2>Version 1.2.129 (2010-02-19)</h2>
......@@ -28,6 +30,9 @@ Change Log
</li><li>MVCC: creating a table with an incorrect constraint could cause strange errors.
</li><li>Hash indexes now are only used for single column indexes.
</li><li>The cache types WEAK_* and TQ are no longer supported.
A weak reference cache never frees up memory so it's the same as
having a very large cache size. The TQ cache was not included in the
jar file since a longer time, and was not tested.
</li><li>The file system abstraction no longer throws SQL exceptions.
</li><li>DatabaseEventListener.diskSpaceIsLow has changed.
</li><li>The CompressTool no longer throw as SQL exceptions. Instead, it throws runtime exceptions.
......@@ -52,7 +57,10 @@ Change Log
</li><li>The following system properties are no longer supported:
h2.overflowExceptions, h2.optimizeDropDependencies, h2.optimizeGroupSorted,
h2.optimizeMinMax, h2.optimizeNot, h2.optimizeIn, h2.optimizeInJoin, h2.reuseSpace*.
</li><li>The setting LOG has currently no effect.
Most of then were there fore a long time, but always with the same value.
There was no unit test with the other value. So changing them was potentially dangerous
(not a lot, but still).
</li><li>The setting LOG has currently no effect (it only had an effect when the page store was disabled).
</li><li>Disabling the page store is no longer supported. The old storage mechanism
has been removed, shrinking the jar file size by almost 10%.
</li><li>The translated resources are now stored in UTF-8 format.
......
......@@ -450,18 +450,19 @@ public class Session extends SessionWithState implements SessionFactory {
database.commit(this);
}
if (undoLog.size() > 0) {
// commit the rows, even when not using MVCC
// see also TableData.addRow
ArrayList<Row> rows = New.arrayList();
synchronized (database) {
while (undoLog.size() > 0) {
UndoLogRecord entry = undoLog.getLast();
entry.commit();
rows.add(entry.getRow());
undoLog.removeLast(false);
}
for (Row r : rows) {
r.commit();
// commit the rows when using MVCC
if (database.isMultiVersion()) {
ArrayList<Row> rows = New.arrayList();
synchronized (database) {
while (undoLog.size() > 0) {
UndoLogRecord entry = undoLog.getLast();
entry.commit();
rows.add(entry.getRow());
undoLog.removeLast(false);
}
for (Row r : rows) {
r.commit();
}
}
}
undoLog.clear();
......
......@@ -25,7 +25,11 @@ public class Row implements SearchRow {
public Row(Value[] data, int memory) {
this.data = data;
this.memory = memory;
if (memory != MEMORY_CALCULATE) {
this.memory = 16 + memory * 4;
} else {
this.memory = MEMORY_CALCULATE;
}
}
public void setKeyAndVersion(SearchRow row) {
......@@ -81,7 +85,7 @@ public class Row implements SearchRow {
public int getMemorySize() {
if (memory != MEMORY_CALCULATE) {
return 16 + memory * 4;
return memory;
}
int m = 8;
for (int i = 0; data != null && i < data.length; i++) {
......
......@@ -110,11 +110,9 @@ public class TableData extends Table {
public void addRow(Session session, Row row) {
int i = 0;
lastModificationId = database.getNextModificationDataId();
// even when not using MVCC
// set the session, to ensure the row is kept in the cache
// until the transaction is committed or rolled back
// otherwise the row is not found when doing insert-delete-rollback
row.setSessionId(session.getId());
if (database.isMultiVersion()) {
row.setSessionId(session.getId());
}
try {
for (; i < indexes.size(); i++) {
Index index = indexes.get(i);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论