Skip to content

Commit 70baeea

Browse files
committed
drop方法bug修复
1 parent 636a622 commit 70baeea

File tree

3 files changed

+18
-106
lines changed

3 files changed

+18
-106
lines changed

src/main/java/org/wowtools/neo4j/rtree/RtreeEditor.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ public static void drop(GraphDatabaseService graphdb, String name, VoidDataNodeV
150150
r.delete();
151151
mMax = (int) metadataNode.getProperty("mMax");
152152
metadataNode.delete();
153+
tx.commit();
153154
}
154155
}
155156
//删掉树上的节点
@@ -178,6 +179,7 @@ public static void drop(GraphDatabaseService graphdb, String name, VoidDataNodeV
178179
}
179180
node.delete();
180181
} while (!stack.isEmpty());
182+
tx.commit();
181183
}
182184
}
183185

src/main/java/org/wowtools/neo4j/rtree/internal/edit/AxialSplitLeaf.java

Lines changed: 0 additions & 105 deletions
This file was deleted.

src/test/java/org/wowtools/neo4j/rtree/RtreeEditorTest.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.locationtech.jts.geom.Polygon;
99
import org.neo4j.graphdb.Transaction;
1010
import org.wowtools.neo4j.rtree.geometry2dold.Neo4jDbManager;
11+
import org.wowtools.neo4j.rtree.internal.define.Labels;
1112
import org.wowtools.neo4j.rtree.pojo.PointNd;
1213
import org.wowtools.neo4j.rtree.pojo.RectNd;
1314
import org.wowtools.neo4j.rtree.util.BooleanDataNodeVisitor;
@@ -137,7 +138,21 @@ public void test() {
137138
Assert.assertEquals(resNum, myVisitor.num);
138139
// end update
139140

140-
// Scanner sin = new Scanner(System.in);
141+
142+
//drop
143+
try (Transaction tx = Neo4jDbManager.getGraphDb().beginTx()) {
144+
RtreeEditor.drop(Neo4jDbManager.getGraphDb(), indexName, (nodeId) -> {
145+
// tx.getNodeById(nodeId).delete();
146+
});
147+
}
148+
try (Transaction tx = Neo4jDbManager.getGraphDb().beginTx()) {
149+
tx.findNodes(Labels.METADATA).forEachRemaining(node -> {throw new RuntimeException("drop未清理干净");});
150+
tx.findNodes(Labels.RTREE_BRANCH).forEachRemaining(node -> {throw new RuntimeException("drop未清理干净");});
151+
tx.findNodes(Labels.RTREE_LEAF).forEachRemaining(node -> {throw new RuntimeException("drop未清理干净");});
152+
}
153+
//drop end
154+
155+
// java.util.Scanner sin = new java.util.Scanner(System.in);
141156
// sin.next();
142157
}
143158

0 commit comments

Comments
 (0)