Unverified 提交 fec9cb49 authored 作者: Andrei Tokar's avatar Andrei Tokar 提交者: GitHub

Merge pull request #1543 from h2database/mvstore-misc

MVStore assorted re-factorings
......@@ -993,7 +993,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
* @param memory the number of bytes used for this page
*/
protected final void removePage(long pos, int memory) {
store.removePage(this, pos, memory);
store.removePage(pos, memory);
}
/**
......@@ -1190,10 +1190,10 @@ public class MVMap<K, V> extends AbstractMap<K, V>
int attempt = 0;
int keyCount;
while((keyCount = rootReference.getAppendCounter()) > 0) {
Page page = Page.create(this,
Page page = Page.createLeaf(this,
Arrays.copyOf(keysBuffer, keyCount),
Arrays.copyOf(valuesBuffer, keyCount),
null, keyCount, 0);
0);
CursorPos pos = rootReference.root.getAppendCursorPos(null);
assert page.map == this;
assert pos != null;
......@@ -1215,7 +1215,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
Page.PageReference children[] = new Page.PageReference[] {
new Page.PageReference(p),
new Page.PageReference(page)};
p = Page.create(this, keys, null, children, p.getTotalCount() + page.getTotalCount(), 0);
p = Page.createNode(this, keys, children, p.getTotalCount() + page.getTotalCount(), 0);
}
break;
}
......@@ -1784,7 +1784,7 @@ public class MVMap<K, V> extends AbstractMap<K, V>
new Page.PageReference(p),
new Page.PageReference(split)
};
p = Page.create(this, keys, null, children, totalCount, 0);
p = Page.createNode(this, keys, children, totalCount, 0);
break;
}
Page c = p;
......
......@@ -154,7 +154,7 @@ public final class MVRTreeMap<V> extends MVMap<SpatialKey, V> {
new Page.PageReference(split),
Page.PageReference.EMPTY
};
p = Page.create(this, keys, null, children, totalCount, 0);
p = Page.createNode(this, keys, children, totalCount, 0);
if(store.getFileStore() != null) {
store.registerUnsavedPage(p.getMemory());
}
......
......@@ -182,10 +182,6 @@ public class Transaction {
int currentStatus = getStatus(currentState);
boolean valid;
switch (status) {
case STATUS_OPEN:
valid = currentStatus == STATUS_CLOSED ||
currentStatus == STATUS_ROLLING_BACK;
break;
case STATUS_ROLLING_BACK:
valid = currentStatus == STATUS_OPEN;
break;
......@@ -207,6 +203,7 @@ public class Transaction {
valid = currentStatus == STATUS_COMMITTED ||
currentStatus == STATUS_ROLLED_BACK;
break;
case STATUS_OPEN:
default:
valid = false;
break;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论