提交 82edcc19 authored 作者: Thomas Mueller's avatar Thomas Mueller

MVStore: compacting a store with an R-tree did not always work.

上级 d2e43296
...@@ -47,6 +47,7 @@ public class TestMVRTree extends TestMVStore { ...@@ -47,6 +47,7 @@ public class TestMVRTree extends TestMVStore {
FileUtils.deleteRecursive(getBaseDir(), true); FileUtils.deleteRecursive(getBaseDir(), true);
FileUtils.createDirectories(getBaseDir()); FileUtils.createDirectories(getBaseDir());
testRemoveAll();
testRandomInsert(); testRandomInsert();
testSpatialKey(); testSpatialKey();
testExample(); testExample();
...@@ -55,6 +56,25 @@ public class TestMVRTree extends TestMVStore { ...@@ -55,6 +56,25 @@ public class TestMVRTree extends TestMVStore {
testRandom(); testRandom();
testRandomFind(); testRandomFind();
} }
private void testRemoveAll() {
String fileName = getBaseDir() + "/testRemoveAll.h3";
FileUtils.delete(fileName);
MVStore s;
s = new MVStore.Builder().fileName(fileName).
pageSplitSize(100).open();
MVRTreeMap<String> map = s.openMap("data",
new MVRTreeMap.Builder<String>());
Random r = new Random(1);
for (int i = 0; i < 1000; i++) {
float x = r.nextFloat() * 50, y = r.nextFloat() * 50;
SpatialKey k = new SpatialKey(i % 100, x, x + 2, y, y + 1);
map.put(k, "i:" + i);
}
s.commit();
map.clear();
s.close();
}
private void testRandomInsert() { private void testRandomInsert() {
String fileName = getBaseDir() + "/testMany.h3"; String fileName = getBaseDir() + "/testMany.h3";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论