提交 c7687784 authored 作者: Thomas Mueller's avatar Thomas Mueller

The spatial index now works in MVCC mode when using the MVStore storage.

上级 6d915060
...@@ -505,7 +505,8 @@ public class Recover extends Tool implements DataHandler { ...@@ -505,7 +505,8 @@ public class Recover extends Tool implements DataHandler {
null, this, null); null, this, null);
ValueDataType valueType = new ValueDataType( ValueDataType valueType = new ValueDataType(
null, this, null); null, this, null);
TransactionMap<Value, Value> dataMap = store.begin().openMap(mapName, keyType, valueType); TransactionMap<Value, Value> dataMap = store.begin().openMap(
mapName, keyType, valueType);
Iterator<Value> dataIt = dataMap.keyIterator(null); Iterator<Value> dataIt = dataMap.keyIterator(null);
boolean init = false; boolean init = false;
while (dataIt.hasNext()) { while (dataIt.hasNext()) {
......
...@@ -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());
testSpatialKey();
testExample(); testExample();
testMany(); testMany();
testSimple(); testSimple();
...@@ -54,6 +55,24 @@ public class TestMVRTree extends TestMVStore { ...@@ -54,6 +55,24 @@ public class TestMVRTree extends TestMVStore {
testRandomFind(); testRandomFind();
} }
private void testSpatialKey() {
SpatialKey a0 = new SpatialKey(0, 1, 2, 3, 4);
SpatialKey a1 = new SpatialKey(0, 1, 2, 3, 4);
SpatialKey b0 = new SpatialKey(1, 1, 2, 3, 4);
SpatialKey c0 = new SpatialKey(1, 1.1f, 2.2f, 3.3f, 4.4f);
assertEquals(0, a0.hashCode());
assertEquals(1, b0.hashCode());
assertTrue(a0.equals(a0));
assertTrue(a0.equals(a1));
assertFalse(a0.equals(b0));
assertTrue(a0.equalsIgnoringId(b0));
assertFalse(b0.equals(c0));
assertFalse(b0.equalsIgnoringId(c0));
assertEquals("0: (1.0/2.0, 3.0/4.0)", a0.toString());
assertEquals("1: (1.0/2.0, 3.0/4.0)", b0.toString());
assertEquals("1: (1.1/2.2, 3.3/4.4)", c0.toString());
}
private void testExample() { private void testExample() {
// create an in-memory store // create an in-memory store
MVStore s = MVStore.open(null); MVStore s = MVStore.open(null);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论