提交 5dbcd675 authored 作者: Thomas Mueller's avatar Thomas Mueller

Various bugfixes and improvements in the page store mechanism (still experimental).

上级 234f2c33
......@@ -148,6 +148,7 @@ class PageBtreeNode extends PageBtree {
return splitPoint2;
}
PageBtree page2 = page.split(splitPoint);
readAllRows();
addChild(x, page2.getPos(), pivot);
index.getPageStore().updateRecord(page, true, page.data);
index.getPageStore().updateRecord(page2, true, page2.data);
......
......@@ -83,22 +83,21 @@ public class PageInputStream extends InputStream {
endOfFile = true;
return;
}
if (trunk == null) {
trunk = new PageStreamTrunk(store, trunkNext);
trunk.read();
trunkNext = trunk.getNextTrunk();
}
int next;
while (true) {
next = trunk.getNextPageData();
if (dataPage == -1 || dataPage == next) {
if (next != -1) {
break;
}
if (trunk == null) {
trunk = new PageStreamTrunk(store, trunkNext);
trunk.read();
trunkNext = trunk.getNextTrunk();
}
if (trunk != null) {
next = trunk.getNextPageData();
if (next == -1) {
trunk = null;
} else if (dataPage == -1 || dataPage == next) {
break;
}
}
}
if (trace.isDebugEnabled()) {
trace.debug("pageIn.readPage " + next);
......
......@@ -7,6 +7,7 @@
package org.h2.test.unit;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
......@@ -31,11 +32,27 @@ public class TestPageStore extends TestBase {
}
public void test() throws Exception {
testLargeIndex();
testUniqueIndex();
testCreateIndexLater();
testFuzzOperations();
}
private void testLargeIndex() throws SQLException {
if (config.memory) {
return;
}
deleteDb("pageStore");
Connection conn = getConnection("pageStore");
conn.createStatement().execute("create table test(id varchar primary key, d varchar)");
PreparedStatement prep = conn.prepareStatement("insert into test values(?, space(500))");
for (int i = 0; i < 20000; i++) {
prep.setString(1, "" + i);
prep.executeUpdate();
}
conn.close();
}
private void testUniqueIndex() throws SQLException {
if (config.memory) {
return;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论