You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by je...@apache.org on 2023/01/02 16:30:39 UTC

[incubator-hugegraph] branch partition-test-check created (now abf7c6e57)

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

jermy pushed a change to branch partition-test-check
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git


      at abf7c6e57 fix: check uncommit due gremlin partition test silently fails

This branch includes the following new commits:

     new abf7c6e57 fix: check uncommit due gremlin partition test silently fails

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-hugegraph] 01/01: fix: check uncommit due gremlin partition test silently fails

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jermy pushed a commit to branch partition-test-check
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git

commit abf7c6e579da3eed5aae9a0817d77a8c019edfc8
Author: Jermy Li <je...@apache.org>
AuthorDate: Tue Jan 3 00:28:02 2023 +0800

    fix: check uncommit due gremlin partition test silently fails
    
    Change-Id: Icdecb9a2c4c3c9f3ee678f63a192e22093f3f9ff
---
 .../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;