From 901da45e591ce52bdd0b520784085c2fc9299f68 Mon Sep 17 00:00:00 2001 From: Jermy Li Date: Tue, 14 Mar 2023 17:59:11 +0800 Subject: [PATCH] fix query dirty edges of a vertex with cache (#2166) fix #2163 Change-Id: I58b26f8a791885800e42821a3d4b2724f4e647a0 --- .../hugegraph/structure/HugeVertex.java | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertex.java b/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertex.java index a61ab5a2fc..c270312b09 100644 --- a/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertex.java +++ b/hugegraph-core/src/main/java/org/apache/hugegraph/structure/HugeVertex.java @@ -36,12 +36,20 @@ import org.apache.hugegraph.backend.query.ConditionQuery; import org.apache.hugegraph.backend.query.Query; import org.apache.hugegraph.backend.query.QueryResults; +import org.apache.hugegraph.backend.serializer.BytesBuffer; import org.apache.hugegraph.backend.tx.GraphTransaction; import org.apache.hugegraph.config.CoreOptions; +import org.apache.hugegraph.perf.PerfUtil.Watched; import org.apache.hugegraph.schema.EdgeLabel; import org.apache.hugegraph.schema.PropertyKey; import org.apache.hugegraph.schema.VertexLabel; import org.apache.hugegraph.type.HugeType; +import org.apache.hugegraph.type.define.Cardinality; +import org.apache.hugegraph.type.define.CollectionType; +import org.apache.hugegraph.type.define.Directions; +import org.apache.hugegraph.type.define.HugeKeys; +import org.apache.hugegraph.type.define.IdStrategy; +import org.apache.hugegraph.util.E; import org.apache.hugegraph.util.collection.CollectionFactory; import org.apache.logging.log4j.util.Strings; import org.apache.tinkerpop.gremlin.structure.Direction; @@ -51,16 +59,6 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty; import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; import org.apache.tinkerpop.gremlin.structure.util.StringFactory; - -import org.apache.hugegraph.backend.serializer.BytesBuffer; -import org.apache.hugegraph.perf.PerfUtil.Watched; -import org.apache.hugegraph.type.define.Cardinality; -import org.apache.hugegraph.type.define.CollectionType; -import org.apache.hugegraph.type.define.Directions; -import org.apache.hugegraph.type.define.HugeKeys; -import org.apache.hugegraph.type.define.IdStrategy; -import org.apache.hugegraph.util.E; -import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyProperty; import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyVertexProperty; import com.google.common.collect.ImmutableList; @@ -383,11 +381,6 @@ public Iterator getVertices(Directions direction, @Override public Iterator edges(Direction tinkerpopDir, String... edgeLabels) { Directions direction = Directions.convert(tinkerpopDir); - // NOTE: get edges from memory if load all edges when loading vertex. - if (this.existsEdges()) { - return this.getEdges(direction, edgeLabels); - } - Id[] edgeLabelIds = this.graph().mapElName2Id(edgeLabels); Query query = GraphTransaction.constructEdgesQuery(this.id(), direction, edgeLabelIds);