You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by va...@apache.org on 2023/01/04 15:19:01 UTC

[incubator-hugegraph] branch master updated: fix: check uncommit due gremlin partition test silently fails (#2065)

This is an automated email from the ASF dual-hosted git repository.

vaughn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git


The following commit(s) were added to refs/heads/master by this push:
     new 7efcf879c fix: check uncommit due gremlin partition test silently fails (#2065)
7efcf879c is described below

commit 7efcf879c1b9bf40125699196773d1fbf21c5f5f
Author: Jermy Li <je...@apache.org>
AuthorDate: Wed Jan 4 23:18:55 2023 +0800

    fix: check uncommit due gremlin partition test silently fails (#2065)
---
 .../java/org/apache/hugegraph/backend/tx/GraphTransaction.java   | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java b/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java
index 3300d3777..4cf3ea108 100644
--- a/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java
+++ b/hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphTransaction.java
@@ -542,12 +542,19 @@ public class GraphTransaction extends IndexableTransaction {
 
     @Override
     public Number queryNumber(Query query) {
+        boolean isConditionQuery = query instanceof ConditionQuery;
         boolean hasUpdate = this.hasUpdate();
         Aggregate aggregate = query.aggregateNotNull();
 
+        // TODO: we can concat index-query results and tx uncommitted records.
+        if (hasUpdate) {
+            E.checkArgument(!isConditionQuery,
+                            "It's not allowed to query by index when " +
+                            "there are uncommitted records.");
+        }
+
         QueryList<Number> queries = this.optimizeQueries(query, q -> {
             boolean isIndexQuery = q instanceof IdQuery;
-            boolean isConditionQuery = query instanceof ConditionQuery;
             assert isIndexQuery || isConditionQuery || q == query;
             // Need to fallback if there are uncommitted records
             boolean fallback = hasUpdate;