提交 218b14f3 authored 作者: Thomas Mueller's avatar Thomas Mueller

Page store improvements.

上级 a8817d0e
...@@ -236,6 +236,7 @@ public class PageBtreeLeaf extends PageBtree { ...@@ -236,6 +236,7 @@ public class PageBtreeLeaf extends PageBtree {
} }
private void writeHead() { private void writeHead() {
data.reset();
data.writeByte((byte) (Page.TYPE_BTREE_LEAF | (onlyPosition ? 0 : Page.FLAG_LAST))); data.writeByte((byte) (Page.TYPE_BTREE_LEAF | (onlyPosition ? 0 : Page.FLAG_LAST)));
data.writeShortInt(0); data.writeShortInt(0);
data.writeInt(parentPageId); data.writeInt(parentPageId);
...@@ -248,7 +249,6 @@ public class PageBtreeLeaf extends PageBtree { ...@@ -248,7 +249,6 @@ public class PageBtreeLeaf extends PageBtree {
return; return;
} }
readAllRows(); readAllRows();
data.reset();
writeHead(); writeHead();
for (int i = 0; i < entryCount; i++) { for (int i = 0; i < entryCount; i++) {
data.writeShortInt(offsets[i]); data.writeShortInt(offsets[i]);
......
...@@ -182,6 +182,7 @@ public class PageBtreeNode extends PageBtree { ...@@ -182,6 +182,7 @@ public class PageBtreeNode extends PageBtree {
rows = newRows; rows = newRows;
childPageIds = newChildPageIds; childPageIds = newChildPageIds;
entryCount++; entryCount++;
written = false;
} }
int addRowTry(SearchRow row) throws SQLException { int addRowTry(SearchRow row) throws SQLException {
...@@ -301,6 +302,7 @@ public class PageBtreeNode extends PageBtree { ...@@ -301,6 +302,7 @@ public class PageBtreeNode extends PageBtree {
PageBtree page = index.getPage(childPageIds[at]); PageBtree page = index.getPage(childPageIds[at]);
SearchRow last = page.remove(row); SearchRow last = page.remove(row);
updateRowCount(-1); updateRowCount(-1);
written = false;
if (last == null) { if (last == null) {
// the last row didn't change - nothing to do // the last row didn't change - nothing to do
return null; return null;
...@@ -373,6 +375,7 @@ public class PageBtreeNode extends PageBtree { ...@@ -373,6 +375,7 @@ public class PageBtreeNode extends PageBtree {
} }
private void writeHead() { private void writeHead() {
data.reset();
data.writeByte((byte) (Page.TYPE_BTREE_NODE | (onlyPosition ? 0 : Page.FLAG_LAST))); data.writeByte((byte) (Page.TYPE_BTREE_NODE | (onlyPosition ? 0 : Page.FLAG_LAST)));
data.writeShortInt(0); data.writeShortInt(0);
data.writeInt(parentPageId); data.writeInt(parentPageId);
...@@ -386,7 +389,6 @@ public class PageBtreeNode extends PageBtree { ...@@ -386,7 +389,6 @@ public class PageBtreeNode extends PageBtree {
return; return;
} }
readAllRows(); readAllRows();
data.reset();
writeHead(); writeHead();
data.writeInt(childPageIds[entryCount]); data.writeInt(childPageIds[entryCount]);
for (int i = 0; i < entryCount; i++) { for (int i = 0; i < entryCount; i++) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论