提交 1758ebf4 authored 作者: Andrei Tokar's avatar Andrei Tokar

invoke beforeWrite() in append mode, fix unsaved memory accounting in flushAppendBuffer

上级 7a60c09e
...@@ -1232,6 +1232,7 @@ public class MVMap<K, V> extends AbstractMap<K, V> ...@@ -1232,6 +1232,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
} }
} }
} else { } else {
tip = tip.parent;
page = Page.createLeaf(this, page = Page.createLeaf(this,
Arrays.copyOf(keysBuffer, keyCount), Arrays.copyOf(keysBuffer, keyCount),
Arrays.copyOf(valuesBuffer, keyCount), Arrays.copyOf(valuesBuffer, keyCount),
...@@ -1323,6 +1324,7 @@ public class MVMap<K, V> extends AbstractMap<K, V> ...@@ -1323,6 +1324,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
* @param value to be appended * @param value to be appended
*/ */
public void append(K key, V value) { public void append(K key, V value) {
beforeWrite();
RootReference rootReference = lockRoot(getRoot(), 1); RootReference rootReference = lockRoot(getRoot(), 1);
int appendCounter = rootReference.getAppendCounter(); int appendCounter = rootReference.getAppendCounter();
try { try {
......
...@@ -62,14 +62,14 @@ class MVPlainTempResult extends MVTempResult { ...@@ -62,14 +62,14 @@ class MVPlainTempResult extends MVTempResult {
super(database, expressions.length, visibleColumnCount); super(database, expressions.length, visibleColumnCount);
ValueDataType valueType = new ValueDataType(database, new int[columnCount]); ValueDataType valueType = new ValueDataType(database, new int[columnCount]);
Builder<Long, ValueRow> builder = new MVMap.Builder<Long, ValueRow>() Builder<Long, ValueRow> builder = new MVMap.Builder<Long, ValueRow>()
.valueType(valueType); .valueType(valueType).singleWriter();
map = store.openMap("tmp", builder); map = store.openMap("tmp", builder);
} }
@Override @Override
public int addRow(Value[] values) { public int addRow(Value[] values) {
assert parent == null; assert parent == null;
map.put(counter++, ValueRow.get(values)); map.append(counter++, ValueRow.get(values));
return ++rowCount; return ++rowCount;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论