[Bug]within do not return the correct result
### Bug Type (问题类型)

gremlin (结果不合预期)

### Before submit

- [X] 我已经确认现有的 [Issues](https://github.com/hugegraph/hugegraph/issues) 与 [FAQ](https://hugegraph.github.io/hugegraph-doc/guides/faq.html) 中没有相同 / 重复问题

### Environment (环境信息)

- Server Version: v0.11.x
- Backend: RocksDB x nodes, HDD or SSD 
- OS: xx CPUs, xx G RAM, Centos 7.x 
- Data Size:  xx vertices, xx edges <!-- (like 1000W 点, 9000W 边) -->


### Expected & Actual behavior (期望与实际表现)

使用within直接查询能起作用，但是多次拼接查询，没数据

gremlin> :> g.V().has('name',Text.contains('诚信')).has('type', 0).where(values('confirmType').is(neq(1))).valueMap('name','confirmType').limit(1)
==>[name:[诚信],confirmType:[0]]
gremlin> :> g.V().has('name',Text.contains('诚信')).has('type', 0).has('confirmType',within(0,2,3)).valueMap('name','confirmType').limit(1)
gremlin>
gremlin> :> g.V().has('type', 0).has('confirmType',within(0,2,3)).has('name',Text.contains('诚信')).valueMap('name','confirmType').limit(1)
gremlin>
gremlin> :> g.V().has('type', 0).has('name',Text.contains('诚信')).has('confirmType',within(3,2,0)).valueMap('name','confirmType').limit(1)
==>[name:[诚信],confirmType:[0]]
gremlin> :> g.V().has('type', 0).has('name',Text.contains('诚信')).valueMap('name','confirmType').limit(1)
==>[name:[诚信],confirmType:[0]]
gremlin> :> g.V().has('type', 0).has('name',Text.contains('诚信')).has('confirmType',0).valueMap('name','confirmType').limit(1)
==>[name:[诚信],confirmType:[0]]

### Vertex/Edge example (问题点 / 边数据举例)

_No response_

### Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
schema.propertyKey("type").asInt().ifNotExist().create();
schema.propertyKey("kid").asInt().ifNotExist().create();
schema.propertyKey("name").asText().ifNotExist().create();
schema.propertyKey("confirmType").asInt().ifNotExist().create();

schema.vertexLabel("test").properties("confirmType","name","kid","type").nullableKeys("confirmType","name","type").primaryKeys("kid").ifNotExist().create();

g.addVertex(T.label, "tets", "name", "诚信", "confirmType", 0, "type", 1,"kid",1);
g.V().has('type', 1).has('confirmType',within(0,2,3)).has('name',Text.contains('诚信'));
g.V().has('type', 1).has('confirmType',within(3,2,0)).has('name',Text.contains('诚信'));


_No response_
diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/page/QueryList.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/page/QueryList.java
index 9739e329..4e209458 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/page/QueryList.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/page/QueryList.java
@@ -219,6 +219,7 @@ public final class QueryList<R> {
         private QueryResults<R> each(IdHolder holder) {
             assert !holder.paging();
             Query bindQuery = holder.query();
+            this.updateResultsFilter(bindQuery);
             this.updateOffsetIfNeeded(bindQuery);
 
             // Iterate by all
@@ -267,6 +268,8 @@ public final class QueryList<R> {
             E.checkArgument(0 <= index && index <= this.holders.size(),
                             "Invalid page index %s", index);
             IdHolder holder = this.holders.get(index);
+            Query bindQuery = holder.query();
+            this.updateResultsFilter(bindQuery);
             PageIds pageIds = holder.fetchNext(page, pageSize);
             if (pageIds.empty()) {
                 return PageResults.emptyIterator();
@@ -298,6 +301,16 @@ public final class QueryList<R> {
             query.copyOffset(parent);
         }
 
+        private void updateResultsFilter(Query query) {
+            while (query != null) {
+                if (query instanceof ConditionQuery) {
+                    ((ConditionQuery) query).updateResultsFilter();
+                    return;
+                }
+                query = query.originQuery();
+            }
+        }
+
         private QueryResults<R> queryByIndexIds(Set<Id> ids) {
             return this.queryByIndexIds(ids, false);
         }
diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Condition.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Condition.java
index ecf7ac87..6be1b6eb 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Condition.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Condition.java
@@ -74,6 +74,7 @@ public abstract class Condition {
                                                   ((Id) v1).asBytes());
         }),
         TEXT_CONTAINS("textcontains", String.class, String.class, (v1, v2) -> {
+            // TODO: support collection-property textcontains
             return v1 != null && ((String) v1).contains((String) v2);
         }),
         TEXT_CONTAINS_ANY("textcontainsany", String.class, Collection.class,
diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
index a2fda90d..fcb2fe95 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
@@ -47,7 +47,6 @@ import com.baidu.hugegraph.util.E;
 import com.baidu.hugegraph.util.InsertionOrderUtil;
 import com.baidu.hugegraph.util.LongEncoding;
 import com.baidu.hugegraph.util.NumericUtil;
-import com.google.common.base.Function;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Sets;
@@ -79,7 +78,7 @@ public class ConditionQuery extends IdQuery {
     private List<Condition> conditions = EMPTY_CONDITIONS;
 
     private OptimizedType optimizedType = OptimizedType.NONE;
-    private Function<HugeElement, Boolean> resultsFilter = null;
+    private ResultsFilter resultsFilter = null;
     private Element2IndexValueMap element2IndexValueMap = null;
 
     public ConditionQuery(HugeType resultType) {
@@ -173,20 +172,11 @@ public class ConditionQuery extends IdQuery {
     }
 
     public void recordIndexValue(Id propertyId, Id id, Object indexValue) {
-        this.ensureElement2IndexValueMap();
-        this.element2IndexValueMap.addIndexValue(propertyId, id, indexValue);
+        this.element2IndexValueMap().addIndexValue(propertyId, id, indexValue);
     }
 
     public void selectedIndexField(Id indexField) {
-        this.ensureElement2IndexValueMap();
-        this.element2IndexValueMap.selectedIndexField(indexField);
-    }
-
-    public Set<LeftIndex> getElementLeftIndex(Id elementId) {
-        if (this.element2IndexValueMap == null) {
-            return null;
-        }
-        return this.element2IndexValueMap.getLeftIndex(elementId);
+        this.element2IndexValueMap().selectedIndexField(indexField);
     }
 
     public void removeElementLeftIndex(Id elementId) {
@@ -197,7 +187,21 @@ public class ConditionQuery extends IdQuery {
     }
 
     public boolean existLeftIndex(Id elementId) {
-        return this.getElementLeftIndex(elementId) != null;
+        return this.getLeftIndexOfElement(elementId) != null;
+    }
+
+    public Set<LeftIndex> getLeftIndexOfElement(Id elementId) {
+        if (this.element2IndexValueMap == null) {
+            return null;
+        }
+        return this.element2IndexValueMap.getLeftIndex(elementId);
+    }
+
+    private Element2IndexValueMap element2IndexValueMap() {
+        if (this.element2IndexValueMap == null) {
+            this.element2IndexValueMap = new Element2IndexValueMap();
+        }
+        return this.element2IndexValueMap;
     }
 
     public List<Condition.Relation> relations() {
@@ -548,14 +552,26 @@ public class ConditionQuery extends IdQuery {
             return false;
         }
 
-        if (this.resultsFilter != null) {
-            return this.resultsFilter.apply(element);
+        /*
+         * Currently results-filter is used to filter unmatched results returned
+         * by search index, and there may be multiple results-filter for every
+         * sub-query like within() + Text.contains().
+         * We can't use sub-query results-filter here for fresh element which is
+         * not committed to backend store, because it's not from a sub-query.
+         */
+        if (this.resultsFilter != null && !element.fresh()) {
+            return this.resultsFilter.test(element);
         }
+
+        /*
+         * NOTE: seems need to keep call checkRangeIndex() for each condition,
+         * so don't break early even if test() return false.
+         */
         boolean valid = true;
         for (Condition cond : this.conditions) {
             valid &= cond.test(element);
-            valid &= (this.element2IndexValueMap == null ||
-                      this.element2IndexValueMap.validRangeIndex(element,  cond));
+            valid &= this.element2IndexValueMap == null ||
+                     this.element2IndexValueMap.checkRangeIndex(element, cond);
         }
         return valid;
     }
@@ -615,14 +631,29 @@ public class ConditionQuery extends IdQuery {
         return this.optimizedType;
     }
 
-    public void registerResultsFilter(Function<HugeElement, Boolean> filter) {
+    public void registerResultsFilter(ResultsFilter filter) {
         assert this.resultsFilter == null;
         this.resultsFilter = filter;
+    }
 
+    public void updateResultsFilter() {
         Query originQuery = this.originQuery();
         if (originQuery instanceof ConditionQuery) {
-            ConditionQuery cq = ((ConditionQuery) originQuery);
-            cq.registerResultsFilter(filter);
+            ConditionQuery originCQ = ((ConditionQuery) originQuery);
+            if (this.resultsFilter != null) {
+                originCQ.updateResultsFilter(this.resultsFilter);
+            } else {
+                originCQ.updateResultsFilter();
+            }
+        }
+    }
+
+    protected void updateResultsFilter(ResultsFilter filter) {
+        this.resultsFilter = filter;
+        Query originQuery = this.originQuery();
+        if (originQuery instanceof ConditionQuery) {
+            ConditionQuery originCQ = ((ConditionQuery) originQuery);
+            originCQ.updateResultsFilter(filter);
         }
     }
 
@@ -638,12 +669,6 @@ public class ConditionQuery extends IdQuery {
         return (ConditionQuery) originQuery;
     }
 
-    private void ensureElement2IndexValueMap() {
-        if (this.element2IndexValueMap == null) {
-            this.element2IndexValueMap = new Element2IndexValueMap();
-        }
-    }
-
     public static String concatValues(List<?> values) {
         assert !values.isEmpty();
         List<Object> newValues = new ArrayList<>(values.size());
@@ -717,7 +742,7 @@ public class ConditionQuery extends IdQuery {
         public void addIndexValue(Id indexField, Id elementId,
                                   Object indexValue) {
             if (!this.filed2IndexValues.containsKey(indexField)) {
-                this.filed2IndexValues.put(indexField, new HashMap<>());
+                this.filed2IndexValues.putIfAbsent(indexField, new HashMap<>());
             }
             Map<Id, Set<Object>> element2IndexValueMap =
                                  this.filed2IndexValues.get(indexField);
@@ -733,15 +758,15 @@ public class ConditionQuery extends IdQuery {
             this.selectedIndexField = indexField;
         }
 
-        public Set<Object> removeIndexValues(Id indexField, Id elementId) {
+        public Set<Object> toRemoveIndexValues(Id indexField, Id elementId) {
             if (!this.filed2IndexValues.containsKey(indexField)) {
                 return null;
             }
             return this.filed2IndexValues.get(indexField).get(elementId);
         }
 
-        public void addLeftIndex(Id indexField, Set<Object> indexValues,
-                                 Id elementId) {
+        public void addLeftIndex(Id elementId, Id indexField,
+                                 Set<Object> indexValues) {
             LeftIndex leftIndex = new LeftIndex(indexValues, indexField);
             if (this.leftIndexMap.containsKey(elementId)) {
                 this.leftIndexMap.get(elementId).add(leftIndex);
@@ -758,7 +783,7 @@ public class ConditionQuery extends IdQuery {
             this.leftIndexMap.remove(elementId);
         }
 
-        public boolean validRangeIndex(HugeElement element, Condition cond) {
+        public boolean checkRangeIndex(HugeElement element, Condition cond) {
             // Not UserpropRelation
             if (!(cond instanceof Condition.UserpropRelation)) {
                 return true;
@@ -767,35 +792,36 @@ public class ConditionQuery extends IdQuery {
             Condition.UserpropRelation propRelation =
                                        (Condition.UserpropRelation) cond;
             Id propId = propRelation.key();
-            Set<Object> fieldValues = this.removeIndexValues(propId,
-                                                             element.id());
+            Set<Object> fieldValues = this.toRemoveIndexValues(propId,
+                                                               element.id());
             if (fieldValues == null) {
                 // Not range index
                 return true;
             }
 
-            HugeProperty<Object> hugeProperty = element.getProperty(propId);
-            if (hugeProperty == null) {
-                // Property value has been deleted
-                this.addLeftIndex(propId, fieldValues, element.id());
+            HugeProperty<Object> property = element.getProperty(propId);
+            if (property == null) {
+                // Property value has been deleted, so it's not matched
+                this.addLeftIndex(element.id(), propId, fieldValues);
                 return false;
             }
 
             /*
-             * NOTE: If success remove means has correct index,
-             * we should add left index values to left index map
-             * waiting to be removed
+             * NOTE: If removing successfully means there is correct index,
+             * else we should add left-index values to left index map to
+             * wait the left-index to be removed.
              */
-            boolean hasRightValue = removeValue(fieldValues, hugeProperty.value());
+            boolean hasRightValue = removeFieldValue(fieldValues,
+                                                     property.value());
             if (fieldValues.size() > 0) {
-                this.addLeftIndex(propId, fieldValues, element.id());
+                this.addLeftIndex(element.id(), propId, fieldValues);
             }
 
             /*
              * NOTE: When query by more than one range index field,
              * if current field is not the selected one, it can only be used to
              * determine whether the index values matched, can't determine
-             * the element is valid or not
+             * the element is valid or not.
              */
             if (this.selectedIndexField != null) {
                 return !propId.equals(this.selectedIndexField) || hasRightValue;
@@ -804,10 +830,11 @@ public class ConditionQuery extends IdQuery {
             return hasRightValue;
         }
 
-        private static boolean removeValue(Set<Object> values, Object value){
-            for (Object compareValue : values) {
-                if (numberEquals(compareValue, value)) {
-                    values.remove(compareValue);
+        private static boolean removeFieldValue(Set<Object> values,
+                                                Object value){
+            for (Object elem : values) {
+                if (numberEquals(elem, value)) {
+                    values.remove(elem);
                     return true;
                 }
             }
@@ -847,4 +874,9 @@ public class ConditionQuery extends IdQuery {
             return this.indexField;
         }
     }
+
+    public static interface ResultsFilter {
+
+        public boolean test(HugeElement element);
+    }
 }
diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
index d497cb9e..3397cc3f 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
@@ -828,7 +828,7 @@ public class GraphIndexTransaction extends AbstractTransaction {
 
     private ConditionQuery constructSearchQuery(ConditionQuery query,
                                                 MatchedIndex index) {
-        ConditionQuery originQuery = query;
+        ConditionQuery newQuery = query;
         Set<Id> indexFields = new HashSet<>();
         // Convert has(key, text) to has(key, textContainsAny(word1, word2))
         for (IndexLabel il : index.indexLabels()) {
@@ -836,39 +836,40 @@ public class GraphIndexTransaction extends AbstractTransaction {
                 continue;
             }
             Id indexField = il.indexField();
-            String fieldValue = (String) query.userpropValue(indexField);
+            String fieldValue = (String) newQuery.userpropValue(indexField);
             Set<String> words = this.segmentWords(fieldValue);
             indexFields.add(indexField);
 
-            query = query.copy();
-            query.unsetCondition(indexField);
-            query.query(Condition.textContainsAny(indexField, words));
+            newQuery = newQuery.copy();
+            newQuery.unsetCondition(indexField);
+            newQuery.query(Condition.textContainsAny(indexField, words));
         }
 
         // Register results filter to compare property value and search text
-        query.registerResultsFilter(elem -> {
-            for (Condition cond : originQuery.conditions()) {
-                Object key = cond.isRelation() ? ((Relation) cond).key() : null;
+        newQuery.registerResultsFilter(element -> {
+            assert element != null;
+            for (Condition cond : query.conditions()) {
+                Object key = cond.isRelation() ?
+                             ((Relation) cond).key() : null;
                 if (key instanceof Id && indexFields.contains(key)) {
                     // This is an index field of search index
                     Id field = (Id) key;
-                    assert elem != null;
-                    HugeProperty<?> property = elem.getProperty(field);
+                    HugeProperty<?> property = element.getProperty(field);
                     String propValue = propertyValueToString(property.value());
-                    String fieldValue = (String) originQuery.userpropValue(field);
+                    String fieldValue = (String) query.userpropValue(field);
                     if (this.matchSearchIndexWords(propValue, fieldValue)) {
                         continue;
                     }
                     return false;
                 }
-                if (!cond.test(elem)) {
+                if (!cond.test(element)) {
                     return false;
                 }
             }
             return true;
         });
 
-        return query;
+        return newQuery;
     }
 
     private boolean matchSearchIndexWords(String propValue, String fieldValue) {
@@ -1053,7 +1054,7 @@ public class GraphIndexTransaction extends AbstractTransaction {
 
     private static IndexQueries buildJointIndexesQueries(ConditionQuery query,
                                                          MatchedIndex index) {
-        IndexQueries queries = new IndexQueries();
+        IndexQueries queries = IndexQueries.of(query);
         List<IndexLabel> allILs = new ArrayList<>(index.indexLabels());
 
         // Handle range/search indexes
@@ -1174,7 +1175,7 @@ public class GraphIndexTransaction extends AbstractTransaction {
     private static IndexQueries constructQueries(ConditionQuery query,
                                                  Set<IndexLabel> ils,
                                                  Set<Id> propKeys) {
-        IndexQueries queries = new IndexQueries();
+        IndexQueries queries = IndexQueries.of(query);
 
         for (IndexLabel il : ils) {
             List<Id> fields = il.indexFields();
@@ -1627,15 +1628,25 @@ public class GraphIndexTransaction extends AbstractTransaction {
                    extends HashMap<IndexLabel, ConditionQuery> {
 
         private static final long serialVersionUID = 1400326138090922676L;
+        private static final IndexQueries EMPTY = new IndexQueries(null);
+
+        private final ConditionQuery parentQuery;
 
-        public static final IndexQueries EMPTY = new IndexQueries();
+        public IndexQueries(ConditionQuery parentQuery) {
+            this.parentQuery = parentQuery;
+        }
 
         public static IndexQueries of(IndexLabel il, ConditionQuery query) {
-            IndexQueries indexQueries = new IndexQueries();
+            IndexQueries indexQueries = new IndexQueries(query);
             indexQueries.put(il, query);
             return indexQueries;
         }
 
+        public static IndexQueries of(ConditionQuery parentQuery) {
+            IndexQueries indexQueries = new IndexQueries(parentQuery);
+            return indexQueries;
+        }
+
         public boolean oomRisk() {
             for (Query subQuery : this.values()) {
                 if (subQuery.bigCapacity() && subQuery.aggregate() != null) {
@@ -1660,26 +1671,36 @@ public class GraphIndexTransaction extends AbstractTransaction {
 
         public Query asJointQuery() {
             @SuppressWarnings({ "unchecked", "rawtypes" })
-            Collection<Query> queries = (Collection) this.values();;
-            return new JointQuery(this.rootQuery().resultType(), queries);
+            Collection<Query> queries = (Collection) this.values();
+            return new JointQuery(this.rootQuery().resultType(),
+                                  this.parentQuery, queries);
         }
 
         private static class JointQuery extends Query {
 
             private final Collection<Query> queries;
+            private final ConditionQuery parentQuery;
 
-            public JointQuery(HugeType type, Collection<Query> queries) {
+            public JointQuery(HugeType type, ConditionQuery parentQuery,
+                              Collection<Query> queries) {
                 super(type, parent(queries));
+                this.parentQuery = parentQuery;
                 this.queries = queries;
             }
 
             @Override
             public Query originQuery() {
+                return this.parentQuery;
+            }
+
+            @SuppressWarnings("unused")
+            public Query originJointQuery() {
                 List<Query> origins = new ArrayList<>();
                 for (Query q : this.queries) {
                     origins.add(q.originQuery());
                 }
-                return new JointQuery(this.resultType(), origins);
+                return new JointQuery(this.resultType(),
+                                      this.parentQuery, origins);
             }
 
             @Override
@@ -1712,7 +1733,7 @@ public class GraphIndexTransaction extends AbstractTransaction {
             this.query = query;
             this.element = element;
             this.tx = null;
-            this.leftIndexes = query.getElementLeftIndex(element.id());
+            this.leftIndexes = query.getLeftIndexOfElement(element.id());
         }
 
         @Override
diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java
index 0adbaa31..b8694188 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java
@@ -777,9 +777,15 @@ public class GraphTransaction extends IndexableTransaction {
     }
 
     public Iterator<Vertex> queryVertices(Query query) {
-        E.checkArgument(this.removedVertices.isEmpty() || query.noLimit(),
-                        "It's not allowed to query with limit when " +
-                        "there are uncommitted delete records.");
+        if (this.hasUpdate()) {
+            E.checkArgument(query.noLimitAndOffset(),
+                            "It's not allowed to query with offser/limit " +
+                            "when there are uncommitted records.");
+            // TODO: also add check: no SCAN, no OLAP
+            E.checkArgument(!query.paging(),
+                            "It's not allowed to query by paging when " +
+                            "there are uncommitted records.");
+        }
 
         query.resetActualOffset();
 
@@ -935,9 +941,15 @@ public class GraphTransaction extends IndexableTransaction {
 
     @Watched
     public Iterator<Edge> queryEdges(Query query) {
-        E.checkArgument(this.removedEdges.isEmpty() || query.noLimit(),
-                        "It's not allowed to query with limit when " +
-                        "there are uncommitted delete records.");
+        if (this.hasUpdate()) {
+            E.checkArgument(query.noLimitAndOffset(),
+                            "It's not allowed to query with offser/limit " +
+                            "when there are uncommitted records.");
+            // TODO: also add check: no SCAN, no OLAP
+            E.checkArgument(!query.paging(),
+                            "It's not allowed to query by paging when " +
+                            "there are uncommitted records.");
+        }
 
         query.resetActualOffset();
 
diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPITest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPITest.java
index 04a1b67a..4d65c274 100644
--- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPITest.java
+++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPITest.java
@@ -48,7 +48,6 @@ public class AdamicAdarAPITest extends BaseApiTest {
 
         String markoId = name2Ids.get("marko");
         String joshId = name2Ids.get("josh");
-        String peterId = name2Ids.get("peter");
         Response r = client().get(PATH, ImmutableMap.of("vertex",
                                                         id2Json(markoId),
                                                         "other",
diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPITest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPITest.java
index ede6b703..72101e68 100644
--- a/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPITest.java
+++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPITest.java
@@ -48,7 +48,6 @@ public class ResourceAllocationAPITest extends BaseApiTest {
 
         String markoId = name2Ids.get("marko");
         String joshId = name2Ids.get("josh");
-        String peterId = name2Ids.get("peter");
         Response r = client().get(PATH, ImmutableMap.of("vertex",
                                                         id2Json(markoId),
                                                         "other",
diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/BaseCoreTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/BaseCoreTest.java
index 59556ab2..43118961 100644
--- a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/BaseCoreTest.java
+++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/BaseCoreTest.java
@@ -19,6 +19,8 @@
 
 package com.baidu.hugegraph.core;
 
+import java.util.Random;
+
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.junit.After;
@@ -102,6 +104,17 @@ public class BaseCoreTest {
         });
     }
 
+    protected void mayCommitTx() {
+        // Commit tx probabilistically for test
+        if (new Random().nextBoolean()) {
+            graph().tx().commit();
+        }
+    }
+
+    protected void commitTx() {
+        graph().tx().commit();
+    }
+
     protected BackendFeatures storeFeatures() {
         return graph().backendStoreFeatures();
     }
diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/EdgeCoreTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/EdgeCoreTest.java
index 51147737..c202f67e 100644
--- a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/EdgeCoreTest.java
+++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/EdgeCoreTest.java
@@ -1828,12 +1828,13 @@ public class EdgeCoreTest extends BaseCoreTest {
     }
 
     @Test
-    public void testQueryAllWithLimitAfterDelete() {
+    public void testQueryAllWithLimitAfterUncommittedDelete() {
         HugeGraph graph = graph();
         init18Edges();
 
         // Query all with limit after delete
         graph.traversal().E().limit(14).drop().iterate();
+
         Assert.assertThrows(IllegalArgumentException.class, () -> {
             // Query count with uncommitted records
             graph.traversal().E().count().next();
@@ -1842,6 +1843,11 @@ public class EdgeCoreTest extends BaseCoreTest {
             // Query with limit
             graph.traversal().E().limit(3).toList();
         });
+        Assert.assertThrows(IllegalArgumentException.class, () -> {
+            // Query with offset
+            graph.traversal().E().range(1, -1).toList();
+        });
+
         graph.tx().commit();
         Assert.assertEquals(4L, graph.traversal().E().count().next());
         List<Edge> edges = graph.traversal().E().limit(3).toList();
@@ -1854,6 +1860,40 @@ public class EdgeCoreTest extends BaseCoreTest {
         Assert.assertEquals(1, edges.size());
     }
 
+    @Test
+    public void testQueryAllWithLimitAfterUncommittedInsert() {
+        HugeGraph graph = graph();
+        init18Edges();
+
+        // Query all with limit after insert
+        Vertex james = graph.addVertex(T.label, "author", "id", 3,
+                                       "name", "James Gosling", "age", 62,
+                                       "lived", "Canadian");
+
+        Vertex book = graph.addVertex(T.label, "book", "name", "Test-Book-1");
+
+        james.addEdge("authored", book,
+                      "comment", "good book!",
+                      "comment", "good book!",
+                      "comment", "good book too!");
+
+        Assert.assertThrows(IllegalArgumentException.class, () -> {
+            // Query count with uncommitted records
+            graph.traversal().E().count().next();
+        });
+        Assert.assertThrows(IllegalArgumentException.class, () -> {
+            // Query with limit
+            graph.traversal().E().limit(3).toList();
+        });
+        Assert.assertThrows(IllegalArgumentException.class, () -> {
+            // Query with offset
+            graph.traversal().E().range(1, -1).toList();
+        });
+
+        graph.tx().commit();
+        Assert.assertEquals(19L, graph.traversal().E().count().next());
+    }
+
     @Test
     public void testQueryAllWithLimitByQueryEdges() {
         HugeGraph graph = graph();
diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java
index 674f0e1e..7ab9be2c 100644
--- a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java
+++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java
@@ -205,7 +205,7 @@ public class VertexCoreTest extends BaseCoreTest {
                         "city", "Beijing", "age", 20);
         graph.addVertex(T.label, "person", "name", "Hebe",
                         "city", "Taipei", "age", 21);
-        graph.tx().commit();
+        this.commitTx();
 
         long count = graph.traversal().V().count().next();
         Assert.assertEquals(6, count);
@@ -324,7 +324,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Vertex vertex = graph.addVertex(T.label, "review", "id", 1,
                                         "comment", "looks good!",
                                         "comment", "LGTM!");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("review", "id", 1);
         Assert.assertEquals(ImmutableList.of("looks good!", "LGTM!"),
@@ -337,7 +337,7 @@ public class VertexCoreTest extends BaseCoreTest {
         vertex = graph.addVertex(T.label, "review", "id", 2,
                                  "comment",
                                  ImmutableList.of("looks good 2!", "LGTM!"));
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("review", "id", 2);
         Assert.assertEquals(ImmutableList.of("looks good 2!", "LGTM!"),
@@ -350,7 +350,7 @@ public class VertexCoreTest extends BaseCoreTest {
         vertex = graph.addVertex(T.label, "review", "id", 3,
                                  "comment",
                                  new String[]{"looks good 3!", "LGTM!"});
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("review", "id", 3);
         Assert.assertEquals(ImmutableList.of("looks good 3!", "LGTM!"),
@@ -408,7 +408,7 @@ public class VertexCoreTest extends BaseCoreTest {
             graph.addVertex(T.label, "soft", "name", "soft" + i,
                             "updateTime", i);
         }
-        graph.tx().commit();
+        this.commitTx();
 
         long count = graph.traversal().V()
                           .has("soft", "updateTime",
@@ -422,7 +422,7 @@ public class VertexCoreTest extends BaseCoreTest {
             graph.addVertex(T.label, "soft", "name", "soft" + i,
                             "updateTime", 2 * i);
         }
-        graph.tx().commit();
+        this.commitTx();
 
         count = graph.traversal().V()
                      .has("soft", "updateTime",
@@ -446,7 +446,7 @@ public class VertexCoreTest extends BaseCoreTest {
                             "age", i,
                             "score", i);
         }
-        graph.tx().commit();
+        this.commitTx();
 
         count = graph.traversal().V()
                      .hasLabel("developer")
@@ -462,7 +462,7 @@ public class VertexCoreTest extends BaseCoreTest {
                             "age", i * 2,
                             "score", i * 2);
         }
-        graph.tx().commit();
+        this.commitTx();
 
         count = graph.traversal().V()
                      .hasLabel("developer")
@@ -498,7 +498,7 @@ public class VertexCoreTest extends BaseCoreTest {
                             "age", i * 3,
                             "score", i * 3);
         }
-        graph.tx().commit();
+        this.commitTx();
 
         if (!removeLeftIndexOnOverwrite) {
             Whitebox.setInternalState(params().graphTransaction(),
@@ -535,7 +535,7 @@ public class VertexCoreTest extends BaseCoreTest {
             graph.addVertex(T.label, "soft", "name", "soft" + i,
                             "country", "china", "updateTime", i);
         }
-        graph.tx().commit();
+        this.commitTx();
 
         long count = graph.traversal().V()
                           .hasLabel("soft")
@@ -550,7 +550,7 @@ public class VertexCoreTest extends BaseCoreTest {
             graph.addVertex(T.label, "soft", "name", "soft" + i,
                             "country", "china", "updateTime", i * 2);
         }
-        graph.tx().commit();
+        this.commitTx();
 
         count = graph.traversal().V()
                      .hasLabel("soft")
@@ -569,7 +569,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                         "contribution", "+1",
                                         "contribution", "+2",
                                         "contribution", "+2");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("review", "id", 1);
         Assert.assertEquals(ImmutableSet.of("+1", "+2"),
@@ -578,7 +578,7 @@ public class VertexCoreTest extends BaseCoreTest {
         vertex = graph.addVertex(T.label, "review", "id", 2,
                                  "contribution",
                                  ImmutableSet.of("+1", "+1", "+2"));
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("review", "id", 2);
         Assert.assertEquals(ImmutableSet.of("+1", "+2"),
@@ -595,16 +595,17 @@ public class VertexCoreTest extends BaseCoreTest {
 
         schema.vertexLabel("soft").properties("name", "tags", "score",
                                               "country", "category")
-              .primaryKeys("name").create();
+              .primaryKeys("name")
+              .create();
 
-        schema.indexLabel("softByTag").onV("soft").secondary()
-              .by("tags").create();
+        schema.indexLabel("softByTag").onV("soft").by("tags")
+              .secondary().create();
 
-        schema.indexLabel("softByCategory").onV("soft").search()
-              .by("category").create();
+        schema.indexLabel("softByScore").onV("soft").by("score")
+              .secondary().create();
 
-        schema.indexLabel("softByScore").onV("soft").secondary()
-              .by("score").create();
+        schema.indexLabel("softByCategory").onV("soft").by("category")
+              .search().create();
 
         HugeGraph graph = graph();
 
@@ -627,7 +628,8 @@ public class VertexCoreTest extends BaseCoreTest {
                         ImmutableList.of("hello graph", "graph database"),
                         "tags", ImmutableList.of("graphdb", "gremlin"));
 
-        graph.tx().commit();
+        // TODO: test mayCommitTx() after support textContains(collection, str)
+        this.commitTx();
 
         List<Vertex> vertices;
         vertices = graph.traversal().V()
@@ -643,47 +645,45 @@ public class VertexCoreTest extends BaseCoreTest {
         Assert.assertEquals(2, vertices.size());
 
         Assert.assertThrows(IllegalStateException.class, () -> {
-            graph.traversal().V().has("soft", "tags",
-                                      "gremlin").toList();
+            graph.traversal().V().has("soft", "tags", "gremlin").toList();
         });
 
         // query by contains
         vertices = graph.traversal().V()
-                        .has("soft", "tags",
-                             ConditionP.contains("gremlin"))
+                        .has("soft", "tags", ConditionP.contains("gremlin"))
                         .toList();
         Assert.assertEquals(2, vertices.size());
 
         // secondary-index with list/set of number properties
         vertices = graph.traversal().V()
-                        .has("soft", "score",
-                             ConditionP.contains(5))
+                        .has("soft", "score", ConditionP.contains(5))
                         .toList();
         Assert.assertEquals(3, vertices.size());
 
         vertices = graph.traversal().V()
-                        .has("soft", "name",
-                             "hugegraph").toList();
+                        .has("soft", "name", "hugegraph").toList();
         Assert.assertEquals(1, vertices.size());
 
         // add a new tag
         Vertex vertex = vertices.get(0);
         vertex.property("tags", ImmutableSet.of("new_tag"));
-        graph.tx().commit();
+
+        this.commitTx();
 
         vertices = graph.traversal().V()
-                        .has("soft", "tags",
-                             ConditionP.contains("new_tag")).toList();
+                        .has("soft", "tags", ConditionP.contains("new_tag"))
+                        .toList();
         Assert.assertEquals(1, vertices.size());
 
         // delete tag gremlin
         vertex = graph.addVertex(T.label, "soft", "name", "hugegraph",
                                  "country", "china",
                                  "score", ImmutableList.of(5, 4, 3),
-                                 "category",
-                                 ImmutableList.of("hello graph", "graph database"),
-                                 "tags", ImmutableList.of("graphdb", "new_tag"));
-        graph.tx().commit();
+                                 "category", ImmutableList.of("hello graph",
+                                                              "graph database"),
+                                 "tags", ImmutableList.of("graphdb",
+                                                          "new_tag"));
+        this.mayCommitTx();
 
         vertices = graph.traversal().V()
                         .has("soft", "tags", ConditionP.contains("gremlin"))
@@ -702,7 +702,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         // remove
         vertex.remove();
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertices = graph.traversal().V()
                         .has("soft", "tags", ConditionP.contains("new_tag"))
@@ -780,6 +780,8 @@ public class VertexCoreTest extends BaseCoreTest {
         // Absent 'age' and 'city'
         Vertex vertex = graph().addVertex(T.label, "person", "name", "Baby");
         Assert.assertEquals("Baby", vertex.value("name"));
+
+        this.mayCommitTx();
     }
 
     @Test
@@ -807,7 +809,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Assert.assertFalse(vertex.values("cnt").hasNext());
         Assert.assertFalse(vertex.values("age").hasNext());
 
-        graph().tx().commit();
+        this.commitTx();
 
         // Exist 'fav' after commit then query
         vertex = graph().vertex(vertex.id());
@@ -881,7 +883,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         Vertex v1 = graph.addVertex(T.label, "programmer", "name", "marko",
                                     "age", 18, "city", "Beijing");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         List<Vertex> vertices = graph.traversal().V().toList();
         Assert.assertEquals(1, vertices.size());
@@ -891,7 +893,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         Vertex v2 = graph.addVertex(T.label, "programmer", "name", "marko",
                                     "age", 18, "city", "Beijing");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         Assert.assertNotEquals(v1.id(), v2.id());
 
@@ -921,7 +923,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         Vertex v1 = graph.addVertex(T.label, "programmer", "name", "marko",
                                     "age", 18, "city", "Beijing");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         List<Vertex> vertices = graph.traversal().V().toList();
         Assert.assertEquals(1, vertices.size());
@@ -931,7 +933,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         Vertex v2 = graph.addVertex(T.label, "programmer", "name", "marko",
                                     "age", 18, "city", "Beijing");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         Assert.assertNotEquals(v1.id(), v2.id());
 
@@ -974,7 +976,7 @@ public class VertexCoreTest extends BaseCoreTest {
               .create();
         graph.addVertex(T.label, "programmer", "name", "marko",
                         "age", 18, "city", "Beijing");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         String programmerId = graph.vertexLabel("programmer").id().asString();
         String vid = String.format("%s:%s!%s", programmerId, "marko", "1I");
@@ -997,7 +999,7 @@ public class VertexCoreTest extends BaseCoreTest {
               .create();
         graph.addVertex(T.label, "programmer", T.id, "123456", "name", "marko",
                         "age", 18, "city", "Beijing");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         List<Vertex> vertices = graph.traversal().V("123456").toList();
         Assert.assertEquals(1, vertices.size());
@@ -1053,7 +1055,7 @@ public class VertexCoreTest extends BaseCoreTest {
                         "age", 18, "city", "Beijing");
         graph.addVertex(T.label, "programmer", T.id, 61695499031416832L,
                         "name", "marko", "age", 19, "city", "Beijing");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         List<Vertex> vertices = graph.traversal().V(123456).toList();
         Assert.assertEquals(1, vertices.size());
@@ -1116,7 +1118,8 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.addVertex(T.label, "programmer",
                         T.id, "835e1153928149578691cf79258e90ee",
                         "name", "marko", "age", 19, "city", "Beijing");
-        graph.tx().commit();
+
+        this.commitTx();
         Assert.assertEquals(2L, graph.traversal().V().count().next());
 
         Object uuid = Text.uuid("835e1153928149578691cf79258e90eb");
@@ -1193,12 +1196,12 @@ public class VertexCoreTest extends BaseCoreTest {
     public void testAddVertexWithTtl() {
         Vertex vertex = graph().addVertex(T.label, "fan", "name", "Baby",
                                           "age", 3, "city", "Beijing");
-        graph().tx().commit();
+        this.commitTx();
 
         Iterator<Vertex> vertices = graph().vertices(vertex);
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(vertex, vertices.next());
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(3100L);
@@ -1215,12 +1218,12 @@ public class VertexCoreTest extends BaseCoreTest {
                         T.label, "follower", "name",
                         "Baby", "age", 3, "city", "Beijing",
                         "birth", graph().now() - 1000L);
-        graph().tx().commit();
+        this.commitTx();
 
         Iterator<Vertex> vertices = graph().vertices(vertex);
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(vertex, vertices.next());
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(1100L);
@@ -1230,7 +1233,7 @@ public class VertexCoreTest extends BaseCoreTest {
         vertices = graph().vertices(vertex);
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(vertex, vertices.next());
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(1100L);
@@ -1248,13 +1251,13 @@ public class VertexCoreTest extends BaseCoreTest {
 
         Vertex vertex = graph().addVertex(T.label, "fan", "name", "Baby",
                                           "age", 3, "city", "Beijing");
-        graph().tx().commit();
+        this.commitTx();
 
         Iterator<Vertex> vertices = graph().traversal().V()
                                            .has("city", "Beijing");
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(vertex, vertices.next());
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(3100L);
@@ -1283,7 +1286,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                            "age", 6, "city", "Beijing");
         Vertex vertex5 = graph().addVertex(T.label, "fan", "name", "Baby5",
                                            "age", 7, "city", "Beijing");
-        graph().tx().commit();
+        this.commitTx();
 
         Iterator<Vertex> vertices = graph().traversal().V().has("age", 5);
         Assert.assertTrue(vertices.hasNext());
@@ -1304,7 +1307,7 @@ public class VertexCoreTest extends BaseCoreTest {
         vertices = graph().traversal().V().has("age", P.lte(4));
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(2, IteratorUtils.count(vertices));
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(3100L);
@@ -1347,7 +1350,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                            "age", 7, "city", "Beijing");
         Vertex vertex6 = graph().addVertex(T.label, "fan", "name", "Baby6",
                                            "age", 5, "city", "Shanghai");
-        graph().tx().commit();
+        this.commitTx();
 
         Iterator<Vertex> vertices = graph().traversal().V().has("city",
                                                                 "Shanghai");
@@ -1378,7 +1381,7 @@ public class VertexCoreTest extends BaseCoreTest {
                           .has("age", P.lte(4));
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(2, IteratorUtils.count(vertices));
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(3100L);
@@ -1417,13 +1420,13 @@ public class VertexCoreTest extends BaseCoreTest {
 
         Vertex vertex = graph().addVertex(T.label, "fan", "name", "Baby",
                                         "age", 3, "city", "Beijing Haidian");
-        graph().tx().commit();
+        this.commitTx();
 
         Iterator<Vertex> vertices = graph().traversal().V().has(
                                     "city", Text.contains("Haidian"));
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(vertex, vertices.next());
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(3100L);
@@ -1443,12 +1446,12 @@ public class VertexCoreTest extends BaseCoreTest {
 
         graph().addVertex(T.label, "fan", "name", "Baby",
                           "age", 3, "city", "Beijing");
-        graph().tx().commit();
+        this.commitTx();
 
         Assert.assertThrows(IllegalArgumentException.class, () -> {
             graph().addVertex(T.label, "fan", "name", "Baby2",
                               "age", 3, "city", "Beijing");
-            graph().tx().commit();
+            this.commitTx();
         });
 
         try {
@@ -1459,7 +1462,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         graph().addVertex(T.label, "fan", "name", "Baby2",
                           "age", 3, "city", "Beijing");
-        graph().tx().commit();
+        this.commitTx();
     }
 
     @Test
@@ -1469,13 +1472,13 @@ public class VertexCoreTest extends BaseCoreTest {
 
         Vertex vertex = graph().addVertex(T.label, "fan", "name", "Baby",
                                           "age", 3, "city", "Beijing");
-        graph().tx().commit();
+        this.commitTx();
 
         Iterator<Vertex> vertices = graph().traversal().V()
                                            .has("city", "Beijing");
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(vertex, vertices.next());
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(3100L);
@@ -1486,7 +1489,7 @@ public class VertexCoreTest extends BaseCoreTest {
         // Override
         vertex = graph().addVertex(T.label, "fan", "name", "Baby",
                                    "age", 3, "city", "Shanghai");
-        graph().tx().commit();
+        this.commitTx();
 
         // Due to overridden vertices are expired,
         // query will lead to async delete
@@ -1496,7 +1499,7 @@ public class VertexCoreTest extends BaseCoreTest {
         vertices = graph().traversal().V().has("city", "Shanghai");
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(vertex, vertices.next());
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(3100L);
@@ -1528,7 +1531,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                            "age", 9, "city", "Beijing");
         Vertex vertex5 = graph().addVertex(T.label, "fan", "name", "Baby5",
                                            "age", 11, "city", "Beijing");
-        graph().tx().commit();
+        this.commitTx();
 
         Iterator<Vertex> vertices = graph().traversal().V().has("age", 7);
         Assert.assertTrue(vertices.hasNext());
@@ -1549,7 +1552,7 @@ public class VertexCoreTest extends BaseCoreTest {
         vertices = graph().traversal().V().has("age", P.lte(5));
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(2, IteratorUtils.count(vertices));
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(3100L);
@@ -1570,7 +1573,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                            "age", 10, "city", "Beijing");
         Vertex vertex10 = graph().addVertex(T.label, "fan", "name", "Baby10",
                                             "age", 12, "city", "Beijing");
-        graph().tx().commit();
+        this.commitTx();
         /*
          * Due to overridden vertices are expired,
          * query will lead to async delete
@@ -1597,7 +1600,7 @@ public class VertexCoreTest extends BaseCoreTest {
         vertices = graph().traversal().V().has("age", P.lte(6));
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(2, IteratorUtils.count(vertices));
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(3100L);
@@ -1644,7 +1647,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                            "age", 9, "city", "Beijing");
         Vertex vertex6 = graph().addVertex(T.label, "fan", "name", "Baby6",
                                            "age", 5, "city", "Shanghai");
-        graph().tx().commit();
+        this.commitTx();
 
         Iterator<Vertex> vertices = graph().traversal().V().has("city",
                                                                 "Shanghai");
@@ -1675,7 +1678,7 @@ public class VertexCoreTest extends BaseCoreTest {
                           .has("age", P.lte(3));
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(2, IteratorUtils.count(vertices));
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(3100L);
@@ -1700,7 +1703,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Vertex vertex12 = graph().addVertex(T.label, "fan",
                                             "name", "Baby12", "age", 6,
                                             "city", "Shenzhen");
-        graph().tx().commit();
+        this.commitTx();
 
         // Due to overridden vertices are expired, query will lead to async delete
         vertices = graph().traversal().V().has("city", "Shanghai");
@@ -1738,7 +1741,7 @@ public class VertexCoreTest extends BaseCoreTest {
                           .has("age", P.lte(4));
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(2, IteratorUtils.count(vertices));
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(3100L);
@@ -1785,13 +1788,13 @@ public class VertexCoreTest extends BaseCoreTest {
 
         Vertex vertex = graph().addVertex(T.label, "fan", "name", "Baby1",
                                           "age", 3, "city", "Beijing Haidian");
-        graph().tx().commit();
+        this.commitTx();
 
         Iterator<Vertex> vertices = graph().traversal().V().has(
                                     "city", Text.contains("Haidian"));
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(vertex, vertices.next());
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(3100L);
@@ -1801,7 +1804,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         vertex = graph().addVertex(T.label, "fan", "name", "Baby2",
                                    "age", 3, "city", "Shanghai Pudong");
-        graph().tx().commit();
+        this.commitTx();
 
         // Due to overridden vertices are expired, query will lead to async delete
         vertices = graph().traversal().V().has("city",
@@ -1812,7 +1815,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                                Text.contains("Pudong"));
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(vertex, vertices.next());
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(3100L);
@@ -1830,7 +1833,7 @@ public class VertexCoreTest extends BaseCoreTest {
     public void testQueryVertexWithTtlInTx() {
         Vertex vertex1 = graph().addVertex(T.label, "fan", "name", "Baby1",
                                            "age", 3, "city", "Beijing");
-        graph().tx().commit();
+        this.commitTx();
         // Add vertices in tx
         Vertex vertex2 = graph().addVertex(T.label, "fan", "name", "Baby2",
                                            "age", 3, "city", "Beijing");
@@ -1842,7 +1845,7 @@ public class VertexCoreTest extends BaseCoreTest {
         vertices = graph().vertices(vertex2);
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(vertex2, vertices.next());
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(3100L);
@@ -1865,7 +1868,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         graph().addVertex(T.label, "fan", "name", "Baby1",
                           "age", 3, "city", "Beijing");
-        graph().tx().commit();
+        this.commitTx();
         // Add vertices in tx
         graph().addVertex(T.label, "fan", "name", "Baby2",
                           "age", 3, "city", "Beijing");
@@ -1874,7 +1877,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                            .has("city", "Beijing");
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(2, IteratorUtils.count(vertices));
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(3100L);
@@ -1902,7 +1905,7 @@ public class VertexCoreTest extends BaseCoreTest {
                           "age", 6, "city", "Beijing");
         graph().addVertex(T.label, "fan", "name", "Baby5",
                           "age", 7, "city", "Beijing");
-        graph().tx().commit();
+        this.commitTx();
 
         // Add vertices in tx
         graph().addVertex(T.label, "fan", "name", "Baby6",
@@ -1935,7 +1938,7 @@ public class VertexCoreTest extends BaseCoreTest {
         vertices = graph().traversal().V().has("age", P.lte(4));
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(4, IteratorUtils.count(vertices));
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(3100L);
@@ -1977,7 +1980,7 @@ public class VertexCoreTest extends BaseCoreTest {
                           "age", 7, "city", "Beijing");
         graph().addVertex(T.label, "fan", "name", "Baby6",
                           "age", 5, "city", "Shanghai");
-        graph().tx().commit();
+        this.commitTx();
 
         // Add vertices in tx
         graph().addVertex(T.label, "fan", "name", "Baby7",
@@ -2022,7 +2025,7 @@ public class VertexCoreTest extends BaseCoreTest {
                           .has("age", P.lte(4));
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(4, IteratorUtils.count(vertices));
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(3100L);
@@ -2062,7 +2065,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         graph().addVertex(T.label, "fan", "name", "Baby1",
                           "age", 3, "city", "Beijing Haidian");
-        graph().tx().commit();
+        this.commitTx();
 
         graph().addVertex(T.label, "fan", "name", "Baby2",
                           "age", 3, "city", "Beijing Haidian");
@@ -2071,7 +2074,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                     "city", Text.contains("Haidian"));
         Assert.assertTrue(vertices.hasNext());
         Assert.assertEquals(2, IteratorUtils.count(vertices));
-        graph().tx().commit();
+        this.commitTx();
 
         try {
             Thread.sleep(3100L);
@@ -2097,7 +2100,8 @@ public class VertexCoreTest extends BaseCoreTest {
               .writeType(WriteType.OLAP_COMMON)
               .ifNotExist().create();
 
-        init10Vertices();
+        this.init10VerticesAndCommit();
+
         String author = graph.vertexLabel("author").id().asString();
         Id id1 = SplicingIdGenerator.splicing(author,
                                               LongEncoding.encodeNumber(1));
@@ -2127,7 +2131,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.addVertex(T.id, id9.asObject(), olapPropName, "i");
         graph.addVertex(T.id, id10.asObject(), olapPropName, "j");
 
-        graph.tx().commit();
+        this.commitTx();
 
         Assert.assertEquals(GraphReadMode.OLTP_ONLY, graph.readMode());
         Assert.assertThrows(NotAllowException.class, () -> {
@@ -2182,7 +2186,8 @@ public class VertexCoreTest extends BaseCoreTest {
               .writeType(WriteType.OLAP_SECONDARY)
               .ifNotExist().create();
 
-        init10Vertices();
+        this.init10VerticesAndCommit();
+
         String author = graph.vertexLabel("author").id().asString();
         Id id1 = SplicingIdGenerator.splicing(author,
                                               LongEncoding.encodeNumber(1));
@@ -2212,7 +2217,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.addVertex(T.id, id9.asObject(), olapPropName, "i");
         graph.addVertex(T.id, id10.asObject(), olapPropName, "j");
 
-        graph.tx().commit();
+        this.commitTx();
 
         Assert.assertEquals(GraphReadMode.OLTP_ONLY, graph.readMode());
         Assert.assertThrows(NotAllowException.class, () -> {
@@ -2268,7 +2273,8 @@ public class VertexCoreTest extends BaseCoreTest {
               .writeType(WriteType.OLAP_RANGE)
               .ifNotExist().create();
 
-        init10Vertices();
+        this.init10VerticesAndCommit();
+
         String author = graph.vertexLabel("author").id().asString();
         Id id1 = SplicingIdGenerator.splicing(author,
                                               LongEncoding.encodeNumber(1));
@@ -2298,7 +2304,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.addVertex(T.id, id9.asObject(), olapPropName, 0.9D);
         graph.addVertex(T.id, id10.asObject(), olapPropName, 1.0D);
 
-        graph.tx().commit();
+        this.commitTx();
 
         Assert.assertEquals(GraphReadMode.OLTP_ONLY, graph.readMode());
         Assert.assertThrows(NotAllowException.class, () -> {
@@ -2392,7 +2398,8 @@ public class VertexCoreTest extends BaseCoreTest {
               .writeType(WriteType.OLAP_SECONDARY)
               .ifNotExist().create();
 
-        init10Vertices();
+        this.init10VerticesAndCommit();
+
         String author = graph.vertexLabel("author").id().asString();
         Id id1 = SplicingIdGenerator.splicing(author,
                                               LongEncoding.encodeNumber(1));
@@ -2422,7 +2429,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.addVertex(T.id, id9.asObject(), "pagerank", 0.9D);
         graph.addVertex(T.id, id10.asObject(), "pagerank", 1.0D);
 
-        graph.tx().commit();
+        this.commitTx();
 
         graph.addVertex(T.id, id1.asObject(), "wcc", "a");
         graph.addVertex(T.id, id2.asObject(), "wcc", "a");
@@ -2435,7 +2442,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.addVertex(T.id, id9.asObject(), "wcc", "f");
         graph.addVertex(T.id, id10.asObject(), "wcc", "f");
 
-        graph.tx().commit();
+        this.commitTx();
 
         Assert.assertEquals(GraphReadMode.OLTP_ONLY, graph.readMode());
         Assert.assertThrows(NotAllowException.class, () -> {
@@ -2566,7 +2573,8 @@ public class VertexCoreTest extends BaseCoreTest {
               .writeType(WriteType.OLAP_SECONDARY)
               .ifNotExist().create();
 
-        init10Vertices();
+        this.init10VerticesAndCommit();
+
         String author = graph.vertexLabel("author").id().asString();
         Id id1 = SplicingIdGenerator.splicing(author,
                                               LongEncoding.encodeNumber(1));
@@ -2576,12 +2584,12 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.addVertex(T.id, id1.asObject(), "pagerank", 0.1D);
         graph.addVertex(T.id, id2.asObject(), "pagerank", 0.2D);
 
-        graph.tx().commit();
+        this.commitTx();
 
         graph.addVertex(T.id, id1.asObject(), "wcc", "a");
         graph.addVertex(T.id, id2.asObject(), "wcc", "b");
 
-        graph.tx().commit();
+        this.commitTx();
 
         Assert.assertEquals(GraphReadMode.OLTP_ONLY, graph.readMode());
         Assert.assertThrows(NotAllowException.class, () -> {
@@ -2669,6 +2677,50 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.readMode(GraphReadMode.OLTP_ONLY);
     }
 
+    @Test
+    public void testQueryOlapWithUpdates() {
+        Assume.assumeTrue("Not support olap properties",
+                          storeFeatures().supportsOlapProperties());
+
+        HugeGraph graph = graph();
+        SchemaManager schema = graph.schema();
+        schema.propertyKey("pagerank")
+              .asDouble().valueSingle()
+              .writeType(WriteType.OLAP_RANGE)
+              .ifNotExist().create();
+
+        this.init10VerticesAndCommit();
+
+        String author = graph.vertexLabel("author").id().asString();
+        Id id1 = SplicingIdGenerator.splicing(author,
+                                              LongEncoding.encodeNumber(1));
+        Id id2 = SplicingIdGenerator.splicing(author,
+                                              LongEncoding.encodeNumber(2));
+
+        graph.addVertex(T.id, id1.asObject(), "pagerank", 0.1D);
+        graph.addVertex(T.id, id2.asObject(), "pagerank", 0.2D);
+
+        graph.readMode(GraphReadMode.ALL);
+
+        // FIXME: expect to throw error here
+//        Assert.assertThrows(IllegalArgumentException.class, () -> {
+//            graph.traversal().V().has("pagerank", 0.1D).toList();
+//        }, e -> {
+//            Assert.assertContains("not allowed to query by olap " +
+//                                 "when there are uncommitted records",
+//                                 e.toString());
+//        });
+
+        this.commitTx();
+
+        List<Vertex> vertices = graph.traversal().V()
+                                     .has("pagerank", 0.2D)
+                                     .toList();
+        Assert.assertEquals(1, vertices.size());
+
+        graph.readMode(GraphReadMode.OLTP_ONLY);
+    }
+
     @Test
     public void testQueryAll() {
         HugeGraph graph = graph();
@@ -2710,7 +2762,7 @@ public class VertexCoreTest extends BaseCoreTest {
     @Test
     public void testQueryAllWithLimit() {
         HugeGraph graph = graph();
-        init10Vertices();
+        this.init10VerticesAndCommit();
 
         // Query all with limit
         List<Vertex> vertices = graph.traversal().V().limit(6).toList();
@@ -2718,12 +2770,13 @@ public class VertexCoreTest extends BaseCoreTest {
     }
 
     @Test
-    public void testQueryAllWithLimitAfterDelete() {
+    public void testQueryAllWithLimitAfterUncommittedDelete() {
         HugeGraph graph = graph();
-        init10Vertices();
+        this.init10VerticesAndCommit();
 
         // Query all with limit after delete
         graph.traversal().V().limit(6).drop().iterate();
+
         Assert.assertThrows(IllegalArgumentException.class, () -> {
             // Query count with uncommitted records
             graph.traversal().V().count().next();
@@ -2732,22 +2785,54 @@ public class VertexCoreTest extends BaseCoreTest {
             // Query with limit
             graph.traversal().V().limit(3).toList();
         });
-        graph.tx().commit();
+        Assert.assertThrows(IllegalArgumentException.class, () -> {
+            // Query with offset
+            graph.traversal().V().range(1, -1).toList();
+        });
+
+        this.commitTx();
         Assert.assertEquals(4L, graph.traversal().V().count().next());
         List<Vertex> vertices = graph.traversal().V().limit(3).toList();
         Assert.assertEquals(3, vertices.size());
 
         // Query all with limit after delete twice
         graph.traversal().V().limit(3).drop().iterate();
-        graph.tx().commit();
+        this.commitTx();
         vertices = graph.traversal().V().limit(3).toList();
         Assert.assertEquals(1, vertices.size());
     }
 
+    @Test
+    public void testQueryAllWithLimitAfterUncommittedInsert() {
+        HugeGraph graph = graph();
+        this.init10VerticesAndCommit();
+
+        // Query all with limit after insert
+        graph.addVertex(T.label, "author", "id", 3,
+                        "name", "test", "age", 88,
+                        "lived", "California");
+
+        Assert.assertThrows(IllegalArgumentException.class, () -> {
+            // Query count with uncommitted records
+            graph.traversal().V().count().next();
+        });
+        Assert.assertThrows(IllegalArgumentException.class, () -> {
+            // Query with limit
+            graph.traversal().V().limit(3).toList();
+        });
+        Assert.assertThrows(IllegalArgumentException.class, () -> {
+            // Query with offset
+            graph.traversal().V().range(1, -1).toList();
+        });
+
+        this.commitTx();
+        Assert.assertEquals(11L, graph.traversal().V().count().next());
+    }
+
     @Test
     public void testQueryAllWithLimitByQueryVertices() {
         HugeGraph graph = graph();
-        init10Vertices();
+        this.init10VerticesAndCommit();
 
         Query query = new Query(HugeType.VERTEX);
         query.limit(1);
@@ -2760,7 +2845,7 @@ public class VertexCoreTest extends BaseCoreTest {
     @Test
     public void testQueryAllWithLimit0() {
         HugeGraph graph = graph();
-        init10Vertices();
+        this.init10VerticesAndCommit();
 
         // Query all with limit 0
         List<Vertex> vertices = graph.traversal().V().limit(0).toList();
@@ -2781,7 +2866,7 @@ public class VertexCoreTest extends BaseCoreTest {
     @Test
     public void testQueryAllWithIllegalLimit() {
         HugeGraph graph = graph();
-        init10Vertices();
+        this.init10VerticesAndCommit();
 
         Assert.assertThrows(IllegalArgumentException.class, () -> {
             graph.traversal().V().limit(-2).toList();
@@ -2795,7 +2880,7 @@ public class VertexCoreTest extends BaseCoreTest {
     @Test
     public void testQueryAllWithOffset() {
         HugeGraph graph = graph();
-        init10Vertices();
+        this.init10VerticesAndCommit();
 
         List<Vertex> vertices = graph.traversal().V().range(8, 100).toList();
         Assert.assertEquals(2, vertices.size());
@@ -2807,7 +2892,7 @@ public class VertexCoreTest extends BaseCoreTest {
     @Test
     public void testQueryAllWithOffsetAndLimit() {
         HugeGraph graph = graph();
-        init10Vertices();
+        this.init10VerticesAndCommit();
 
         List<Vertex> vertices = graph.traversal().V().range(8, 9).toList();
         Assert.assertEquals(1, vertices.size());
@@ -2831,7 +2916,7 @@ public class VertexCoreTest extends BaseCoreTest {
     @Test
     public void testQueryAllWithOffsetAndLimitWithMultiTimes() {
         HugeGraph graph = graph();
-        init10Vertices();
+        this.init10VerticesAndCommit();
 
         List<Vertex> vertices = graph.traversal().V()
                                      .range(1, 6)
@@ -2865,7 +2950,7 @@ public class VertexCoreTest extends BaseCoreTest {
     @Test
     public void testQueryAllWithIllegalOffsetOrLimit() {
         HugeGraph graph = graph();
-        init10Vertices();
+        this.init10VerticesAndCommit();
 
         Assert.assertThrows(IllegalArgumentException.class, () -> {
             graph.traversal().V().range(8, 7).toList();
@@ -2888,6 +2973,7 @@ public class VertexCoreTest extends BaseCoreTest {
     public void testQueryWithSplicingId() {
         HugeGraph graph = graph();
         init10Vertices();
+
         List<Vertex> vertices = graph.traversal().V().toList();
         String bookId = graph.vertexLabel("book").id().asString();
         Assert.assertTrue(Utils.containsId(vertices,
@@ -2977,7 +3063,7 @@ public class VertexCoreTest extends BaseCoreTest {
     @Test
     public void testQueryByIdWithGraphAPIAndNotCommitedRemoved() {
         HugeGraph graph = graph();
-        init10Vertices();
+        this.init10VerticesAndCommit();
 
         List<Vertex> vertices = graph.traversal().V()
                                      .hasLabel("author").toList();
@@ -3085,7 +3171,7 @@ public class VertexCoreTest extends BaseCoreTest {
     @Test
     public void testQueryByLabelWithLimit() {
         HugeGraph graph = graph();
-        init10Vertices();
+        this.init10VerticesAndCommit();
 
         // Query by vertex label with limit
         List<Vertex> vertices = graph.traversal().V().hasLabel("book")
@@ -3094,7 +3180,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         // Query by vertex label with limit
         graph.traversal().V().hasLabel("book").limit(3).drop().iterate();
-        graph.tx().commit();
+        this.commitTx();
 
         vertices = graph.traversal().V().hasLabel("book")
                         .limit(3).toList();
@@ -3312,7 +3398,8 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.traversal().V().hasLabel("person")
              .has("city", "Beijing").limit(2)
              .drop().iterate();
-        graph.tx().commit();
+        this.commitTx();
+
         vertices = graph.traversal().V().hasLabel("person")
                         .has("city", "Beijing").limit(2).toList();
         Assert.assertEquals(1, vertices.size());
@@ -3659,7 +3746,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.traversal().V().hasLabel("person")
              .has("age", P.between(3, 21)).limit(3)
              .drop().iterate();
-        graph.tx().commit();
+        this.commitTx();
 
         vertices = graph.traversal().V().hasLabel("person")
                         .has("age", P.between(3, 21)).limit(3).toList();
@@ -3690,7 +3777,7 @@ public class VertexCoreTest extends BaseCoreTest {
         // override vertex without age (in backend) and make left index
         graph.addVertex(T.label, "person", "name", "Baby","city", "Hongkong")
              .remove(); // avoid merge property mode
-        graph.tx().commit();
+        this.mayCommitTx();
 
         // qeury again after commit
         vertices = graph.traversal().V().hasLabel("person")
@@ -3749,7 +3836,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph().addVertex(T.label, "number", "id", 8,
                           "int", Integer.MIN_VALUE + 1);
 
-        graph().tx().commit();
+        this.mayCommitTx();
 
         List<Vertex> vertices = graph.traversal().V().hasLabel("number")
                                      .has("int", 0).toList();
@@ -3831,7 +3918,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph().addVertex(T.label, "number", "id", 10,
                           "long", Long.MIN_VALUE + 1);
 
-        graph().tx().commit();
+        this.mayCommitTx();
 
         List<Vertex> vertices = graph.traversal().V().hasLabel("number")
                                      .has("long", 0).toList();
@@ -3926,7 +4013,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph().addVertex(T.label, "number", "id", 12,
                           "float", -secondSmallest);
 
-        graph().tx().commit();
+        this.mayCommitTx();
 
         List<Vertex> vertices = graph.traversal().V().hasLabel("number")
                                      .has("float", 7).toList();
@@ -4039,7 +4126,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph().addVertex(T.label, "number", "id", 9, "double", min15);
         graph().addVertex(T.label, "number", "id", 10, "double", -min15);
 
-        graph().tx().commit();
+        this.mayCommitTx();
 
         List<Vertex> vertices = graph.traversal().V().hasLabel("number")
                                      .has("double", 7).toList();
@@ -4126,7 +4213,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph().addVertex(T.label, "number", "id", 8,
                           "double", -secondSmallest);
 
-        graph().tx().commit();
+        this.mayCommitTx();
 
         List<Vertex> vertices = graph.traversal().V().hasLabel("number")
                                      .has("double", 0.123456789012345678901d)
@@ -4234,7 +4321,8 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.traversal().V().hasLabel("person")
              .has("birth", P.between(dates[1], dates[4]))
              .limit(2).drop().iterate();
-        graph.tx().commit();
+        this.commitTx();
+
         vertices = graph.traversal().V().hasLabel("person")
                         .has("birth", P.between(dates[1], dates[4]))
                         .limit(2).toList();
@@ -4370,7 +4458,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph().addVertex(T.label, "user", "id", 1, "uuid", uuid1);
         graph().addVertex(T.label, "user", "id", 2, "uuid", uuid2);
 
-        graph().tx().commit();
+        this.mayCommitTx();
 
         List<Vertex> vertices = graph.traversal().V().hasLabel("user")
                                      .has("uuid", uuid1).toList();
@@ -4399,7 +4487,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph().addVertex(T.label, "user", "id", 1, "blob", blob1);
         graph().addVertex(T.label, "user", "id", 2, "blob", blob2);
 
-        graph().tx().commit();
+        this.mayCommitTx();
 
         List<Vertex> vertices = graph.traversal().V().hasLabel("user")
                                      .has("blob", blob1).toList();
@@ -4431,7 +4519,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Assert.assertEquals(1, vertices.size());
 
         // Committed
-        graph.tx().commit();
+        this.commitTx();
         vertices = graph.traversal().V()
                         .hasLabel("author")
                         .has("lived", Text.contains("Bay Area"))
@@ -4464,7 +4552,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.addVertex(T.label, "author", "id", 1,
                         "name", "James Gosling",  "age", 62,
                         "lived", "San Francisco Bay Area");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         // By authorByLivedSearch index
         List<Vertex> vertices = graph.traversal().V()
@@ -4508,7 +4596,7 @@ public class VertexCoreTest extends BaseCoreTest {
                         "lived", "Tokyo Bay");
         graph.addVertex(T.label, "author", "id", 5, "name", "James", "age", 62,
                         "lived", "San Francisco Bay Area");
-        graph.tx().commit();
+        this.commitTx();
 
         List<Vertex> vertices = graph.traversal().V()
                                      .hasLabel("author")
@@ -4577,7 +4665,7 @@ public class VertexCoreTest extends BaseCoreTest {
                         "lived", "Tokyo Bay");
         graph.addVertex(T.label, "author", "id", 5, "name", "James", "age", 62,
                         "lived", "San Francisco Bay Area");
-        graph.tx().commit();
+        this.commitTx();
 
         List<Vertex> vertices = graph.traversal().V()
                                      .hasLabel("author")
@@ -4603,14 +4691,14 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.addVertex(T.label, "author", "id", 1,
                         "name", "James Gosling",  "age", 62,
                         "lived", "San Francisco Bay Area");
-        graph.tx().commit();
+        this.commitTx();
 
         // Override the origin vertex with different property value
         // and then lead to index left
         graph.addVertex(T.label, "author", "id", 1,
                         "name", "James Gosling",  "age", 62,
                         "lived", "San Francisco, California, U.S.");
-        graph.tx().commit();
+        this.commitTx();
 
         // Set breakpoint to observe the store before and after this statement
         List<Vertex> vertices = graph.traversal().V().hasLabel("author")
@@ -4632,7 +4720,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.addVertex(T.label, "author", "id", 1,
                         "name", "James Gosling",  "age", 62,
                         "lived", "San Francisco Bay Area");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         Assert.assertThrows(NoIndexException.class, () -> {
             graph.traversal().V().hasLabel("author")
@@ -4688,7 +4776,7 @@ public class VertexCoreTest extends BaseCoreTest {
                         "city", "Beijing", "age", 28);
         graph.addVertex(T.label, "person", "name", "Zhangyi",
                         "city", "Hongkong", "age", 29);
-        graph.tx().commit();
+        this.mayCommitTx();
 
         List<Vertex> vertices = graph.traversal().V().has("age", 28).toList();
         Assert.assertEquals(0, vertices.size());
@@ -4705,7 +4793,7 @@ public class VertexCoreTest extends BaseCoreTest {
                         "city", "Beijing", "age", 28);
         graph.addVertex(T.label, "person", "name", "Zhangyi",
                         "city", "Hongkong", "age", 29);
-        graph.tx().commit();
+        this.mayCommitTx();
 
         List<Vertex> vertices = graph.traversal().V().has("city", "Beijing")
                                      .toList();
@@ -4803,9 +4891,10 @@ public class VertexCoreTest extends BaseCoreTest {
                         "age", 18, "city", "Beijing");
         Vertex v = graph.addVertex(T.label, "person", "name", "james",
                                    "age", 19, "city", "Hongkong");
-        graph().tx().commit();
+        this.commitTx();
 
         v.property("age", 20);
+        // Don't commit
 
         List<Vertex> vertices = graph.traversal().V()
                                      .where(__.values("age").is(20))
@@ -4891,7 +4980,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         graph().addVertex(T.label, "person", "name", "Tom",
                           "city", "Hongkong", "age", 3);
-        graph().tx().commit();
+        this.commitTx();
 
         List<Vertex> vertices;
         vertices = graph().traversal().V().has("age", 3).toList();
@@ -4902,6 +4991,10 @@ public class VertexCoreTest extends BaseCoreTest {
                           .has("age", 3).toList();
         Assert.assertEquals(1, vertices.size());
 
+        /*
+         * NOTE: may block if not commit records:
+         * Lock [hugegraph_il_delete:3] is locked by other operation
+         */
         graph().schema().indexLabel("personByCityAndAge").onV("person")
                .by("city", "age").ifNotExist().create();
 
@@ -4934,6 +5027,7 @@ public class VertexCoreTest extends BaseCoreTest {
                           "city", "Hongkong", "age", 3);
         graph().addVertex(T.label, "cat", "name", "Baby",
                           "city", "Hongkong", "age", 3);
+        this.mayCommitTx();
 
         List<Vertex> vertices;
         vertices = graph().traversal().V().has("age", 3)
@@ -4958,7 +5052,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         graph().addVertex(T.label, "dog", "name", "Tom",
                           "city", "Hongkong", "age", 3);
-        graph().tx().commit();
+        this.mayCommitTx();
 
         List<Vertex> vertices = graph().traversal().V().has("age", 3)
                                        .has("city", "Hongkong")
@@ -4990,7 +5084,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         graph().addVertex(T.label, "dog", "name", "Tom",
                           "city", "Hongkong", "age", 3);
-        graph().tx().commit();
+        this.mayCommitTx();
 
         List<Vertex> vertices = graph().traversal().V().has("age", P.gt(2))
                                        .has("city", "Hongkong").toList();
@@ -5007,7 +5101,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         graph().addVertex(T.label, "dog", "name", "Tom",
                           "age", 8, "weight", 3);
-        graph().tx().commit();
+        this.mayCommitTx();
 
         List<Vertex> vertices = graph().traversal().V().has("age", P.gt(2))
                                        .has("weight", P.lt(10)).toList();
@@ -5032,7 +5126,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph().addVertex(T.label, "dog", "name", "Coco", "age", 3,
                           "description", "yellow hair golden tail");
 
-        graph().tx().commit();
+        this.commitTx();
 
         List<Vertex> vertices;
         vertices = graph().traversal().V()
@@ -5079,7 +5173,7 @@ public class VertexCoreTest extends BaseCoreTest {
                           "city", "Shanghai",
                           "description", "yellow hair golden tail");
 
-        graph().tx().commit();
+        this.commitTx();
 
         List<Vertex> vertices;
         vertices = graph().traversal().V()
@@ -5141,7 +5235,7 @@ public class VertexCoreTest extends BaseCoreTest {
                           "city", "Shanghai Pudong",
                           "description", "yellow hair golden tail");
 
-        graph().tx().commit();
+        this.commitTx();
 
         List<Vertex> vertices;
         vertices = graph().traversal().V()
@@ -5191,6 +5285,70 @@ public class VertexCoreTest extends BaseCoreTest {
         Assert.assertEquals(0, vertices.size());
     }
 
+    @Test
+    public void testQueryByJointIndexesWithSearchAndTwoRangeIndexesAndWithin() {
+        SchemaManager schema = graph().schema();
+
+        schema.propertyKey("type").asInt().ifNotExist().create();
+        schema.propertyKey("kid").asInt().ifNotExist().create();
+        schema.propertyKey("name").asText().ifNotExist().create();
+        schema.propertyKey("confirmType").asInt().ifNotExist().create();
+
+        schema.vertexLabel("test")
+              .properties("confirmType", "name", "kid", "type")
+              .nullableKeys("confirmType", "name", "type")
+              .primaryKeys("kid")
+              .ifNotExist().create();
+
+        schema.indexLabel("test_by_type")
+              .onV("test").by("type")
+              .range()
+              .ifNotExist().create();
+        schema.indexLabel("test_by_confirmType")
+              .onV("test").by("confirmType")
+              .range()
+              .ifNotExist().create();
+        schema.indexLabel("test_by_name")
+              .onV("test").by("name")
+              .search()
+              .ifNotExist().create();
+
+        HugeGraph graph = graph();
+
+        graph.addVertex(T.label, "test", "name", "诚信",
+                        "confirmType", 0, "type", 0, "kid", 0);
+        graph.addVertex(T.label, "test", "name", "诚信",
+                        "confirmType", 1, "type", 1, "kid", 1);
+        graph.addVertex(T.label, "test", "name", "诚信文明",
+                        "confirmType", 2, "type", 1, "kid", 2);
+        graph.addVertex(T.label, "test", "name", "诚信文明",
+                        "confirmType", 3, "type", 1, "kid", 3);
+
+        this.mayCommitTx();
+
+        List<Vertex> vertices;
+        vertices = graph().traversal().V()
+                          .has("type", 1)
+                          .has("confirmType", P.within(0, 1, 2, 3))
+                          .has("name", Text.contains("诚信"))
+                          .toList();
+        Assert.assertEquals(3, vertices.size());
+
+        vertices = graph().traversal().V()
+                          .has("type", 1)
+                          .has("confirmType", P.within(0, 1, 2, 3))
+                          .has("name", Text.contains("文明"))
+                          .toList();
+        Assert.assertEquals(2, vertices.size());
+
+        vertices = graph().traversal().V()
+                          .has("type", 0)
+                          .has("confirmType", P.within(0, 1, 3))
+                          .has("name", Text.contains("诚信"))
+                          .toList();
+        Assert.assertEquals(1, vertices.size());
+    }
+
     @Test
     public void testQueryByShardIndex() {
         SchemaManager schema = graph().schema();
@@ -5210,7 +5368,7 @@ public class VertexCoreTest extends BaseCoreTest {
                         "city", "Beijing", "age", 23);
         graph.addVertex(T.label, "person", "name", "p5",
                         "city", "Beijing", "age", 29);
-        graph.tx().commit();
+        this.mayCommitTx();
 
         List<Vertex> vertices = graph().traversal().V()
                                        .has("city", "Hongkong")
@@ -5693,15 +5851,16 @@ public class VertexCoreTest extends BaseCoreTest {
         schema.indexLabel("userByName").onV("user").by("name").unique()
               .create();
         Vertex v = graph().addVertex(T.label, "user", "name", "Tom");
-        graph().tx().commit();
+        this.commitTx();
+
         Assert.assertThrows(IllegalArgumentException.class, () -> {
             graph().addVertex(T.label, "user", "name", "Tom");
-            graph().tx().commit();
+            this.commitTx();
         });
 
         v.remove();
         graph().addVertex(T.label, "user", "name", "Tom");
-        graph().tx().commit();
+        this.commitTx();
     }
 
     @Test
@@ -5715,7 +5874,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph().addVertex(T.label, "user", "name", "Tom");
         Assert.assertThrows(IllegalArgumentException.class, () -> {
             graph().addVertex(T.label, "user", "name", "Tom");
-            graph().tx().commit();
+            this.commitTx();
         });
     }
 
@@ -5730,16 +5889,17 @@ public class VertexCoreTest extends BaseCoreTest {
         Vertex tom = graph().addVertex(T.label, "user", "name", "Tom");
         Vertex jack = graph().addVertex(T.label, "user", "name", "Jack");
         Vertex james = graph().addVertex(T.label, "user", "name", "James");
-        graph().tx().commit();
+        this.commitTx();
 
         tom.remove();
-        graph().tx().commit();
+        this.commitTx();
+
         jack.property("name", "Tom");
-        graph().tx().commit();
+        this.commitTx();
 
         james.remove();
         jack.property("name", "James");
-        graph().tx().commit();
+        this.commitTx();
     }
 
     @Test
@@ -5754,38 +5914,38 @@ public class VertexCoreTest extends BaseCoreTest {
               .unique().create();
         graph().addVertex(T.label, "user", "name", "Tom",
                           "city", "Beijing", "age", 18);
-        graph().tx().commit();
+        this.commitTx();
 
         // Nullable properties
         graph().addVertex(T.label, "user", "name", "Tom", "city", "Beijing");
-        graph().tx().commit();
+        this.commitTx();
         graph().addVertex(T.label, "user", "name", "Tom", "age", 18);
-        graph().tx().commit();
+        this.commitTx();
         graph().addVertex(T.label, "user", "city", "Beijing", "age", 18);
-        graph().tx().commit();
+        this.commitTx();
         graph().addVertex(T.label, "user", "name", "Tom");
-        graph().tx().commit();
+        this.commitTx();
         graph().addVertex(T.label, "user", "age", 18);
-        graph().tx().commit();
+        this.commitTx();
         graph().addVertex(T.label, "user", "city", "Beijing");
-        graph().tx().commit();
+        this.commitTx();
         graph().addVertex(T.label, "user");
-        graph().tx().commit();
+        this.commitTx();
 
         // Empty String properties
         graph().addVertex(T.label, "user", "name", "", "city", "", "age", 18);
-        graph().tx().commit();
+        this.commitTx();
         graph().addVertex(T.label, "user", "name", "", "city", "");
-        graph().tx().commit();
+        this.commitTx();
         graph().addVertex(T.label, "user", "name", "", "age", 18);
-        graph().tx().commit();
+        this.commitTx();
         graph().addVertex(T.label, "user", "city", "", "age", 18);
-        graph().tx().commit();
+        this.commitTx();
         graph().addVertex(T.label, "user", "name", "");
-        graph().tx().commit();
+        this.commitTx();
         Assert.assertThrows(IllegalArgumentException.class, () -> {
             graph().addVertex(T.label, "user", "age", 18);
-            graph().tx().commit();
+            this.commitTx();
         }, e -> {
             String message = e.getMessage();
             Assert.assertTrue(message.contains("Unique constraint " +
@@ -5793,16 +5953,16 @@ public class VertexCoreTest extends BaseCoreTest {
             Assert.assertTrue(message.contains("conflict is found"));
         });
         graph().addVertex(T.label, "user", "city", "");
-        graph().tx().commit();
+        this.commitTx();
 
         Assert.assertThrows(IllegalArgumentException.class, () -> {
             graph().addVertex(T.label, "user");
-            graph().tx().commit();
+            this.commitTx();
         });
 
         Assert.assertThrows(IllegalArgumentException.class, () -> {
             graph().addVertex(T.label, "user", "city", "\\u0001");
-            graph().tx().commit();
+            this.commitTx();
         });
     }
 
@@ -5823,7 +5983,7 @@ public class VertexCoreTest extends BaseCoreTest {
               .create();
 
         graph.addVertex(T.label, "node", "name", "tom");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         Assert.assertThrows(NoIndexException.class, () -> {
             graph.traversal().V().hasLabel("node").has("name", "tom").next();
@@ -5848,7 +6008,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         Vertex vertex = vertex("author", "id", 1);
         vertex.remove();
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertices = graph.traversal().V().toList();
         Assert.assertEquals(9, vertices.size());
@@ -5873,7 +6033,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.addVertex(T.label, "author", "id", 2,
                         "name", "Guido van Rossum", "age", 61,
                         "lived", "California");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         List<Vertex> vertices = graph.traversal().V().toList();
         Assert.assertEquals(2, vertices.size());
@@ -5884,7 +6044,7 @@ public class VertexCoreTest extends BaseCoreTest {
         // remove vertex without label index
         Vertex vertex = vertex("author2", "id", 1);
         graph.removeVertex(vertex.label(), vertex.id());
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertices = graph.traversal().V().toList();
         Assert.assertEquals(1, vertices.size());
@@ -5895,7 +6055,7 @@ public class VertexCoreTest extends BaseCoreTest {
         // remove vertex with label index
         vertex = vertex("author", "id", 2);
         graph.removeVertex(vertex.label(), vertex.id());
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertices = graph.traversal().V().toList();
         Assert.assertEquals(0, vertices.size());
@@ -5914,7 +6074,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         Vertex vertex = vertex("author", "id", 1);
         vertex.remove();
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertices = graph.traversal().V().toList();
         Assert.assertEquals(9, vertices.size());
@@ -5924,7 +6084,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         // Remove again
         vertex.remove();
-        graph.tx().commit();
+        this.mayCommitTx();
     }
 
     @Test
@@ -5954,7 +6114,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         for (int i = 0; i < vertices.size(); i++) {
             vertices.get(i).remove();
-            graph.tx().commit();
+            this.mayCommitTx();
             Assert.assertEquals(9 - i, graph.traversal().V().toList().size());
         }
     }
@@ -5964,13 +6124,13 @@ public class VertexCoreTest extends BaseCoreTest {
         HugeGraph graph = graph();
         Vertex vertex = graph.addVertex(T.label, "author", "id", 1,
                                         "name", "Tom");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         // Add properties
         vertex.property("name", "Tom2");
         vertex.property("age", 10);
         vertex.property("lived", "USA");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("author", "id", 1);
         Assert.assertEquals("Tom2", vertex.property("name").value());
@@ -5983,13 +6143,13 @@ public class VertexCoreTest extends BaseCoreTest {
         HugeGraph graph = graph();
         Vertex vertex = graph.addVertex(T.label, "author", "id", 1,
                                         "name", "Tom");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("author", "id", 1);
         Assert.assertEquals("Tom", vertex.property("name").value());
 
         vertex.property("name", "Tom2");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("author", "id", 1);
         Assert.assertEquals("Tom2", vertex.property("name").value());
@@ -6000,13 +6160,13 @@ public class VertexCoreTest extends BaseCoreTest {
         HugeGraph graph = graph();
         Vertex vertex = graph.addVertex(T.label, "person", "name", "Tom",
                                         "city", "Hongkong", "age", 3);
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("person", "name", "Tom");
         Assert.assertEquals(3, vertex.property("age").value());
 
         vertex.property("age", 4);
-        graph.tx().commit();
+        this.mayCommitTx();
 
         Assert.assertEquals(4, vertex.property("age").value());
         vertex = vertex("person", "name", "Tom");
@@ -6029,7 +6189,7 @@ public class VertexCoreTest extends BaseCoreTest {
         HugeGraph graph = graph();
         Vertex vertex = graph.addVertex(T.label, "author", "id", 1,
                                         "name", "Jim");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         Assert.assertThrows(IllegalArgumentException.class, () -> {
             vertex.property("prop-not-exist", "2017-1-1");
@@ -6041,7 +6201,7 @@ public class VertexCoreTest extends BaseCoreTest {
         HugeGraph graph = graph();
         Vertex vertex = graph.addVertex(T.label, "author", "id", 1,
                                         "name", "Jim");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         Assert.assertEquals(1, vertex.property("id").value());
         Assert.assertThrows(IllegalArgumentException.class, () -> {
@@ -6061,7 +6221,7 @@ public class VertexCoreTest extends BaseCoreTest {
                         "city", "c\\u0002", "age", 2);
         graph.addVertex(T.label, "person", "name", "3",
                         "city", "d\\u0003", "age", 3);
-        graph.tx().commit();
+        this.mayCommitTx();
 
         List<Vertex> vertices;
 
@@ -6084,7 +6244,7 @@ public class VertexCoreTest extends BaseCoreTest {
             Assert.assertThrows(Exception.class, () -> {
                 graph.addVertex(T.label, "person", "name", "0",
                                 "city", "a\\u0000", "age", 0);
-                graph.tx().commit();
+                this.commitTx();
             }, e -> {
                 if (e instanceof BackendException) {
                     Assert.assertContains("0x00", e.getCause().getMessage());
@@ -6095,7 +6255,7 @@ public class VertexCoreTest extends BaseCoreTest {
         } else {
             graph.addVertex(T.label, "person", "name", "0",
                             "city", "a\\u0000", "age", 0);
-            graph.tx().commit();
+            this.commitTx();
 
             vertices = graph.traversal().V().has("city", "a\\u0000").toList();
             Assert.assertEquals(1, vertices.size());
@@ -6111,7 +6271,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Assert.assertThrows(IllegalArgumentException.class, () -> {
             graph.addVertex(T.label, "person", "name", "Baby",
                             "city", "\\u0000", "age", 3);
-            graph.tx().commit();
+            this.commitTx();
         }, e -> {
             Assert.assertContains("Illegal leading char '\\\\u0' in index",
                                   e.getMessage());
@@ -6120,7 +6280,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Assert.assertThrows(IllegalArgumentException.class, () -> {
             graph.addVertex(T.label, "person", "name", "Baby",
                             "city", "\\u0001", "age", 3);
-            graph.tx().commit();
+            this.commitTx();
         }, e -> {
             Assert.assertContains("Illegal leading char '\\\\u1' in index",
                                   e.getMessage());
@@ -6129,7 +6289,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Assert.assertThrows(IllegalArgumentException.class, () -> {
             graph.addVertex(T.label, "person", "name", "Baby",
                             "city", "\\u0002", "age", 3);
-            graph.tx().commit();
+            this.commitTx();
         }, e -> {
             Assert.assertContains("Illegal leading char '\\\\u2' in index",
                                   e.getMessage());
@@ -6138,7 +6298,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Assert.assertThrows(IllegalArgumentException.class, () -> {
             graph.addVertex(T.label, "person", "name", "Baby",
                             "city", "\\u0003", "age", 3);
-            graph.tx().commit();
+            this.commitTx();
         }, e -> {
             Assert.assertContains("Illegal leading char '\\\\u3' in index",
                                   e.getMessage());
@@ -6151,10 +6311,10 @@ public class VertexCoreTest extends BaseCoreTest {
                           storeFeatures().supportsMergeVertexProperty());
 
         HugeGraph graph = graph();
-        // "city" is a nonnullable property
+        // "city" is a non-nullable property
         graph.addVertex(T.label, "person", "name", "marko", "city", "Beijing",
                         "birth", "1992-11-17 12:00:00.000");
-        graph.tx().commit();
+        this.commitTx();
         Vertex vertex = vertex("person", "name", "marko");
         Assert.assertEquals("Beijing", vertex.value("city"));
         Assert.assertEquals(Utils.date("1992-11-17 12:00:00.000"),
@@ -6163,7 +6323,7 @@ public class VertexCoreTest extends BaseCoreTest {
         // append property 'age'
         graph.addVertex(T.label, "person", "name", "marko", "city", "Beijing",
                         "age", 26);
-        graph.tx().commit();
+        this.commitTx();
         Assert.assertEquals("Beijing", vertex.value("city"));
         vertex = vertex("person", "name", "marko");
         Assert.assertEquals(26, (int) vertex.value("age"));
@@ -6172,7 +6332,7 @@ public class VertexCoreTest extends BaseCoreTest {
         // update property "birth" and keep the original properties unchanged
         graph.addVertex(T.label, "person", "name", "marko", "city", "Beijing",
                         "birth", "1993-11-17 12:00:00.000");
-        graph.tx().commit();
+        this.commitTx();
         vertex = vertex("person", "name", "marko");
         Assert.assertEquals("Beijing", vertex.value("city"));
         Assert.assertEquals(26, (int) vertex.value("age"));
@@ -6185,14 +6345,14 @@ public class VertexCoreTest extends BaseCoreTest {
         HugeGraph graph = graph();
         Vertex v = graph.addVertex(T.label, "author", "id", 1,
                                    "name", "Tom", "age", 10, "lived", "USA");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         // Remove "name" property
         Assert.assertTrue(v.property("name").isPresent());
         Assert.assertTrue(v.property("lived").isPresent());
         Assert.assertThrows(IllegalArgumentException.class, () -> {
             v.property("name").remove();
-            graph.tx().commit();
+            this.commitTx();
         });
         Assert.assertTrue(v.property("name").isPresent());
         Assert.assertTrue(v.property("lived").isPresent());
@@ -6202,7 +6362,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Assert.assertTrue(vertex.property("name").isPresent());
         Assert.assertTrue(vertex.property("lived").isPresent());
         vertex.property("lived").remove();
-        graph.tx().commit();
+        this.mayCommitTx();
         Assert.assertTrue(vertex.property("name").isPresent());
         Assert.assertFalse(vertex.property("lived").isPresent());
 
@@ -6266,7 +6426,7 @@ public class VertexCoreTest extends BaseCoreTest {
         initPersonIndex(true);
 
         graph.addVertex(T.label, "person", "name", "Baby", "city", "");
-        graph.tx().commit();
+        this.commitTx();
 
         Vertex vertex = graph.traversal().V().has("city", "").next();
         Assert.assertEquals("Baby", vertex.value("name"));
@@ -6280,7 +6440,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         Vertex vertex = graph.addVertex(T.label, "person", "name", "Baby",
                                         "city", "Hongkong", "age", 3);
-        graph.tx().commit();
+        this.commitTx();
 
         List<Vertex> vl = graph.traversal().V().has("age", 3).toList();
         Assert.assertEquals(1, vl.size());
@@ -6295,7 +6455,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         vertex.property("age", 5);
         vertex.property("city", "Shanghai");
-        graph.tx().commit();
+        this.commitTx();
 
         vl = graph.traversal().V().has("age", 3).toList();
         Assert.assertEquals(0, vl.size());
@@ -6316,7 +6476,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         Vertex vertex = graph.addVertex(T.label, "person", "name", "Baby",
                                         "city", "Hongkong", "age", 3);
-        graph.tx().commit();
+        this.commitTx();
 
         List<Vertex> vl = graph.traversal().V().has("city", "Hongkong").toList();
         Assert.assertEquals(1, vl.size());
@@ -6325,7 +6485,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Assert.assertEquals(0, vl.size());
 
         vertex.property("city", "Shanghai");
-        graph.tx().commit();
+        this.commitTx();
 
         vl = graph.traversal().V().has("city", "Hongkong").toList();
         Assert.assertEquals(0, vl.size());
@@ -6341,7 +6501,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         Vertex vertex = graph.addVertex(T.label, "person", "name", "Baby",
                                         "city", "Hongkong", "age", 3);
-        graph.tx().commit();
+        this.commitTx();
 
         List<Vertex> vl = graph.traversal().V().has("age", 3).toList();
         Assert.assertEquals(1, vl.size());
@@ -6350,7 +6510,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Assert.assertEquals(0, vl.size());
 
         vertex.property("age", 5);
-        graph.tx().commit();
+        this.commitTx();
 
         vl = graph.traversal().V().has("age", 3).toList();
         Assert.assertEquals(0, vl.size());
@@ -6366,8 +6526,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         graph.addVertex(T.label, "computer", "name", "1st", "band", "10Gbps",
                         "cpu", "2GHz", "ram", "8GB", "price", 1000);
-        graph.tx().commit();
-
+        this.commitTx();
 
         List<Vertex> vl = graph.traversal().V().has("cpu", "2GHz").toList();
         Assert.assertEquals(1, vl.size());
@@ -6384,11 +6543,11 @@ public class VertexCoreTest extends BaseCoreTest {
         HugeGraph graph = graph();
         Vertex vertex = graph.addVertex(T.label, "author", "id", 1,
                                         "name", "Tom", "lived", "Beijing");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex.property("lived").remove();
         vertex.property("lived", "Shanghai");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("author", "id", 1);
         Assert.assertEquals("Shanghai", vertex.property("lived").value());
@@ -6399,7 +6558,7 @@ public class VertexCoreTest extends BaseCoreTest {
         HugeGraph graph = graph();
         Vertex vertex = graph.addVertex(T.label, "author", "id", 1,
                                         "name", "Tom", "lived", "Beijing");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex.property("lived").remove();
         vertex.property("lived").remove();
@@ -6407,7 +6566,7 @@ public class VertexCoreTest extends BaseCoreTest {
         vertex.property("lived", "Hangzhou");
         vertex.property("lived", "Shanghai");
 
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("author", "id", 1);
         Assert.assertEquals("Shanghai", vertex.property("lived").value());
@@ -6422,7 +6581,7 @@ public class VertexCoreTest extends BaseCoreTest {
         vertex.property("lived").remove();
         vertex.property("lived", "Shanghai");
 
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("author", "id", 1);
         Assert.assertEquals("Shanghai", vertex.property("lived").value());
@@ -6433,7 +6592,7 @@ public class VertexCoreTest extends BaseCoreTest {
         HugeGraph graph = graph();
         graph.addVertex(T.label, "author", "id", 1,
                         "name", "Tom", "lived", "Beijing");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         Vertex vertex = vertex("author", "id", 1);
         Assert.assertThrows(IllegalArgumentException.class, () -> {
@@ -6457,9 +6616,13 @@ public class VertexCoreTest extends BaseCoreTest {
     @Test
     public void testUpdateVertexPropertyOfAddingVertex() {
         HugeGraph graph = graph();
+        Vertex vertex0 = graph.addVertex(T.label, "author", "id", 1,
+                                         "name", "Tom", "lived", "Beijing");
+        vertex0.property("lived").remove();
+
         Vertex vertex = graph.addVertex(T.label, "author", "id", 1,
                                         "name", "Tom", "lived", "Beijing");
-        graph.tx().commit();
+        this.commitTx();
 
         graph.addVertex(T.label, "author", "id", 1,
                         "name", "Tom", "lived", "Beijing");
@@ -6477,7 +6640,7 @@ public class VertexCoreTest extends BaseCoreTest {
         HugeGraph graph = graph();
         Vertex vertex = graph.addVertex(T.label, "author", "id", 1,
                                         "name", "Tom", "lived", "Beijing");
-        graph.tx().commit();
+        this.commitTx();
 
         vertex.remove();
 
@@ -6494,7 +6657,7 @@ public class VertexCoreTest extends BaseCoreTest {
         HugeGraph graph = graph();
         Vertex vertex = graph.addVertex(T.label, "author", "id", 1,
                                         "name", "Tom", "lived", "Beijing");
-        graph.tx().commit();
+        this.commitTx();
 
         graph.traversal().V(vertex.id()).drop().iterate();
 
@@ -6542,7 +6705,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         graph.addVertex(T.label, "student", "name", "Tom", "worstScore", 55,
                         "bestScore", 96, "testNum", 1, "rank", 8, "reword", 8);
-        graph.tx().commit();
+        this.commitTx();
 
         Vertex tom = graph.traversal().V().hasLabel("student")
                           .has("name", "Tom").next();
@@ -6557,7 +6720,7 @@ public class VertexCoreTest extends BaseCoreTest {
         tom.property("testNum", 1);
         tom.property("rank", 12);
         tom.property("reword", 12);
-        graph.tx().commit();
+        this.commitTx();
 
         tom = graph.traversal().V().hasLabel("student")
                    .has("name", "Tom").next();
@@ -6572,7 +6735,7 @@ public class VertexCoreTest extends BaseCoreTest {
         tom.property("testNum", 1);
         tom.property("rank", 8);
         tom.property("reword", 8);
-        graph.tx().commit();
+        this.commitTx();
 
         tom = graph.traversal().V().hasLabel("student")
                    .has("name", "Tom").next();
@@ -6588,7 +6751,7 @@ public class VertexCoreTest extends BaseCoreTest {
         tom.property("testNum", 1);
         tom.property("rank", 1);
         tom.property("reword", 1);
-        graph.tx().commit();
+        this.commitTx();
 
         tom = graph.traversal().V().hasLabel("student")
                    .has("name", "Tom").next();
@@ -6651,7 +6814,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Assert.assertEquals(ImmutableSet.of(8, 12), result.value("rank"));
         Assert.assertEquals(ImmutableList.of(8, 12), result.value("reword"));
 
-        graph.tx().commit();
+        this.commitTx();
 
         result = graph.traversal().V().hasLabel("student")
                       .has("name", "Tom").next();
@@ -6686,7 +6849,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Assert.assertEquals(ImmutableList.of(2, 1),
                             tom.value("reword"));
 
-        graph.tx().commit();
+        this.commitTx();
         result = graph.traversal().V().hasLabel("student")
                       .has("name", "Tom").next();
         Assert.assertEquals(65, result.value("worstScore"));
@@ -6765,7 +6928,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         graph.addVertex(T.label, "student", "name", "Tom", "worstScore", 55,
                         "bestScore", 96, "testNum", 1, "no", "001");
-        graph.tx().commit();
+        this.commitTx();
 
         List<Vertex> vertices = graph.traversal().V().hasLabel("student")
                                      .has("name", "Tom").toList();
@@ -6802,7 +6965,7 @@ public class VertexCoreTest extends BaseCoreTest {
         tom.property("bestScore", 98);
         tom.property("testNum", 1);
         tom.property("no", "002");
-        graph.tx().commit();
+        this.commitTx();
 
         vertices = graph.traversal().V().hasLabel("student")
                         .has("name", "Tom").toList();
@@ -6840,7 +7003,7 @@ public class VertexCoreTest extends BaseCoreTest {
         tom.property("bestScore", 99);
         tom.property("testNum", 1);
         tom.property("no", "003");
-        graph.tx().commit();
+        this.commitTx();
 
         vertices = graph.traversal().V().hasLabel("student")
                         .has("name", "Tom").toList();
@@ -6878,7 +7041,7 @@ public class VertexCoreTest extends BaseCoreTest {
         tom.property("bestScore", 100);
         tom.property("testNum", 1);
         tom.property("no", "004");
-        graph.tx().commit();
+        this.commitTx();
 
         vertices = graph.traversal().V().hasLabel("student")
                         .has("name", "Tom").toList();
@@ -6916,19 +7079,19 @@ public class VertexCoreTest extends BaseCoreTest {
         tom.property("bestScore", 99);
         tom.property("testNum", 1);
         tom.property("no", "005");
-        graph.tx().commit();
+        this.commitTx();
 
         tom.property("worstScore", 65);
         tom.property("bestScore", 93);
         tom.property("testNum", 1);
         tom.property("no", "006");
-        graph.tx().commit();
+        this.commitTx();
 
         tom.property("worstScore", 58);
         tom.property("bestScore", 63);
         tom.property("testNum", 1);
         tom.property("no", "007");
-        graph.tx().commit();
+        this.commitTx();
 
         vertices = graph.traversal().V().hasLabel("student")
                         .has("name", "Tom").toList();
@@ -7014,7 +7177,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.addVertex(T.label, "student", "name", "Tom", "worstScore", 55,
                         "bestScore", 96, "testNum", 1, "no", "001",
                         "rank", 1, "reword", 1);
-        graph.tx().commit();
+        this.commitTx();
 
         List<Vertex> vertices = graph.traversal().V().hasLabel("student")
                                      .has("name", "Tom").toList();
@@ -7045,7 +7208,7 @@ public class VertexCoreTest extends BaseCoreTest {
             reword = random.nextInt();
             rewords.add(reword);
             tom.property("reword", reword);
-            graph.tx().commit();
+            this.commitTx();
 
             tom = graph.traversal().V().hasLabel("student")
                        .has("name", "Tom").next();
@@ -7068,7 +7231,7 @@ public class VertexCoreTest extends BaseCoreTest {
                         "name", "Tom", "lived", "Beijing");
         graph.addVertex(T.label, "author", "id", 1,
                         "name", "Tom", "lived", "Shanghai");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         Vertex vertex = vertex("author", "id", 1);
         Assert.assertEquals("Shanghai", vertex.property("lived").value());
@@ -7081,7 +7244,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Vertex vertex = graph.addVertex(T.label, "author", "id", 1,
                                         "name", "Tom", "lived", "Beijing");
         vertex.remove();
-        graph.tx().commit();
+        this.mayCommitTx();
 
         Assert.assertNull(vertex("author", "id", 1));
     }
@@ -7093,7 +7256,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Vertex vertex = graph.addVertex(T.label, "author", "id", 1,
                                         "name", "Tom", "lived", "Beijing");
         vertex.property("lived", "Shanghai");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("author", "id", 1);
         Assert.assertEquals("Shanghai", vertex.property("lived").value());
@@ -7106,7 +7269,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Vertex vertex = graph.addVertex(T.label, "author", "id", 1,
                                         "name", "Tom", "lived", "Beijing");
         vertex.property("lived").remove();
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("author", "id", 1);
         Assert.assertFalse(vertex.property("lived").isPresent());
@@ -7123,7 +7286,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.traversal().V().hasLabel("author").has("id", 1).next().remove();
         graph.addVertex(T.label, "author", "id", 1,
                         "name", "Tom", "lived", "Shanghai");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         Vertex vertex = vertex("author", "id", 1);
         Assert.assertTrue(vertex.property("lived").isPresent());
@@ -7138,7 +7301,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                         "name", "Tom", "lived", "Beijing");
         vertex.remove();
         vertex.remove();
-        graph.tx().commit();
+        this.mayCommitTx();
 
         Assert.assertNull(vertex("author", "id", 1));
     }
@@ -7151,7 +7314,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                         "name", "Tom", "lived", "Beijing");
         vertex.remove();
         vertex.property("lived", "Shanghai");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         Assert.assertNull(vertex("author", "id", 1));
     }
@@ -7164,7 +7327,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                         "name", "Tom", "lived", "Beijing");
         vertex.remove();
         vertex.property("lived").remove();
-        graph.tx().commit();
+        this.mayCommitTx();
 
         Assert.assertNull(vertex("author", "id", 1));
     }
@@ -7179,7 +7342,7 @@ public class VertexCoreTest extends BaseCoreTest {
         vertex.property("lived", "Wuhan");
         graph.addVertex(T.label, "author", "id", 1, "name", "Tom",
                         "lived", "Shanghai");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("author", "id", 1);
         Assert.assertTrue(vertex.property("lived").isPresent());
@@ -7194,7 +7357,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                         "name", "Tom", "lived", "Beijing");
         vertex.property("lived", "Wuhan");
         vertex.remove();
-        graph.tx().commit();
+        this.mayCommitTx();
 
         Assert.assertNull(vertex("author", "id", 1));
     }
@@ -7206,7 +7369,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                         "name", "Tom", "lived", "Beijing");
         vertex.property("lived", "Wuhan");
         vertex.property("lived", "Shanghai");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("author", "id", 1);
         Assert.assertEquals("Shanghai", vertex.property("lived").value());
@@ -7219,7 +7382,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                         "name", "Tom", "lived", "Beijing");
         vertex.property("name", "Tomcat");
         vertex.property("lived", "Shanghai");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("author", "id", 1);
         Assert.assertEquals("Tomcat", vertex.property("name").value());
@@ -7233,7 +7396,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                         "name", "Tom", "lived", "Beijing");
         vertex.property("lived", "Shanghai");
         vertex.property("lived").remove();
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("author", "id", 1);
         Assert.assertFalse(vertex.property("lived").isPresent());
@@ -7246,7 +7409,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                         "name", "Tom", "lived", "Beijing");
         vertex.property("name", "Tomcat");
         vertex.property("lived").remove();
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("author", "id", 1);
         Assert.assertFalse(vertex.property("lived").isPresent());
@@ -7263,7 +7426,7 @@ public class VertexCoreTest extends BaseCoreTest {
         vertex.property("lived").remove();
         graph.addVertex(T.label, "author", "id", 1, "name", "Tom",
                         "lived", "Shanghai");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("author", "id", 1);
         Assert.assertTrue(vertex.property("lived").isPresent());
@@ -7278,7 +7441,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                         "name", "Tom", "lived", "Beijing");
         vertex.property("lived").remove();
         vertex.remove();
-        graph.tx().commit();
+        this.mayCommitTx();
 
         Assert.assertNull(vertex("author", "id", 1));
     }
@@ -7290,7 +7453,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                         "name", "Tom", "lived", "Beijing");
         vertex.property("lived").remove();
         vertex.property("lived", "Shanghai");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("author", "id", 1);
         Assert.assertTrue(vertex.property("lived").isPresent());
@@ -7305,7 +7468,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         vertex.property("lived").remove();
         vertex.property("name", "Tomcat");
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("author", "id", 1);
         Assert.assertFalse(vertex.property("lived").isPresent());
@@ -7319,7 +7482,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                         "name", "Tom", "lived", "Beijing");
         vertex.property("lived").remove();
         vertex.property("lived").remove();
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("author", "id", 1);
         Assert.assertFalse(vertex.property("lived").isPresent());
@@ -7332,7 +7495,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                         "name", "Tom", "lived", "Beijing");
         vertex.property("age").remove();
         vertex.property("lived").remove();
-        graph.tx().commit();
+        this.mayCommitTx();
 
         vertex = vertex("author", "id", 1);
         Assert.assertFalse(vertex.property("age").isPresent());
@@ -7345,7 +7508,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         graph.addVertex(T.label, "person", "name", "marko",
                         "age", 18, "city", "Beijing");
-        graph.tx().commit();
+        this.mayCommitTx();
         Vertex vertex = vertex("person", "name", "marko");
         Assert.assertTrue(vertex.property("age").isPresent());
         Assert.assertEquals(18, vertex.value("age"));
@@ -7353,7 +7516,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Assert.assertEquals("Beijing", vertex.value("city"));
 
         graph.addVertex(T.label, "person", "name", "marko", "city", "Wuhan");
-        graph.tx().commit();
+        this.mayCommitTx();
         vertex = vertex("person", "name", "marko");
         Assert.assertFalse(vertex.property("age").isPresent());
         Assert.assertTrue(vertex.property("city").isPresent());
@@ -7361,7 +7524,7 @@ public class VertexCoreTest extends BaseCoreTest {
 
         graph.addVertex(T.label, "person", "name", "marko",
                         "age", 19, "city", "Shanghai");
-        graph.tx().commit();
+        this.mayCommitTx();
         vertex = vertex("person", "name", "marko");
         Assert.assertTrue(vertex.property("age").isPresent());
         Assert.assertEquals(19, vertex.value("age"));
@@ -7369,7 +7532,6 @@ public class VertexCoreTest extends BaseCoreTest {
         Assert.assertEquals("Shanghai", vertex.value("city"));
     }
 
-    @SuppressWarnings("unchecked")
     @Test
     public void testScanVertex() {
         HugeGraph graph = graph();
@@ -7377,13 +7539,14 @@ public class VertexCoreTest extends BaseCoreTest {
         Assume.assumeTrue("Not support scan",
                           storeFeatures().supportsScanToken() ||
                           storeFeatures().supportsScanKeyRange());
-        init10Vertices();
+        this.init10VerticesAndCommit();
 
         List<Vertex> vertices = new LinkedList<>();
 
         long splitSize = 1 * 1024 * 1024;
-        Object splits = graph.metadata(HugeType.VERTEX, "splits", splitSize);
-        for (Shard split : (List<Shard>) splits) {
+        List<Shard> splits = graph.metadata(HugeType.VERTEX, "splits",
+                                            splitSize);
+        for (Shard split : splits) {
             ConditionQuery q = new ConditionQuery(HugeType.VERTEX);
             q.scan(split.start(), split.end());
             vertices.addAll(ImmutableList.copyOf(graph.vertices(q)));
@@ -7398,7 +7561,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Assume.assumeTrue("Not support scan",
                           storeFeatures().supportsScanToken() ||
                           storeFeatures().supportsScanKeyRange());
-        init10Vertices();
+        this.init10VerticesAndCommit();
 
         List<Vertex> vertices = new LinkedList<>();
         ConditionQuery query = new ConditionQuery(HugeType.VERTEX);
@@ -7895,6 +8058,27 @@ public class VertexCoreTest extends BaseCoreTest {
         });
     }
 
+    @Test
+    public void testQueryByPageWithtUncommittedRecords() {
+        Assume.assumeTrue("Not support paging",
+                          storeFeatures().supportsQueryByPage());
+
+        HugeGraph graph = graph();
+
+        graph.addVertex(T.label, "author", "id", 1,
+                        "name", "James Gosling", "age", 62,
+                        "lived", "Canadian");
+        graph.addVertex(T.label, "author", "id", 2,
+                        "name", "Guido van Rossum", "age", 61,
+                        "lived", "California");
+
+        Assert.assertThrows(IllegalArgumentException.class, () -> {
+            graph.traversal().V()
+                 .has("~page", "")
+                 .toList();
+        });
+    }
+
     @Test
     public void testQueryByLabelInPageWithLimitLtePageSize() {
         Assume.assumeTrue("Not support paging",
@@ -8542,16 +8726,16 @@ public class VertexCoreTest extends BaseCoreTest {
 
         graph.addVertex(T.label, "programmer", T.id, "123456", "name", "marko",
                         "age", 18, "city", "Beijing");
-        graph.tx().commit();
+        this.commitTx();
 
         graph.addVertex(T.label, "programmer", T.id, "123456", "name", "marko",
                         "age", 19, "city", "Beijing");
-        graph.tx().commit();
+        this.commitTx();
 
         graph.addVertex(T.label, "designer", T.id, "123456", "name", "marko",
                         "age", 18, "city", "Beijing");
         Assert.assertThrows(HugeException.class, () -> {
-            graph.tx().commit();
+            this.commitTx();
         });
     }
 
@@ -8565,7 +8749,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.addVertex(T.label, "user", T.id, 123);
         graph.addVertex(T.label, "user", T.id, 456);
         graph.addVertex(T.label, "user", T.id, 789);
-        graph.tx().commit();
+        this.mayCommitTx();
 
         GraphTraversalSource g = graph.traversal();
         List<Vertex> vertices;
@@ -8600,7 +8784,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.addVertex(T.label, "user1", T.id, 123);
         graph.addVertex(T.label, "user2", T.id, 456);
         graph.addVertex(T.label, "user2", T.id, 789);
-        graph.tx().commit();
+        this.mayCommitTx();
 
         GraphTraversalSource g = graph.traversal();
         List<Vertex> vertices;
@@ -8738,7 +8922,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Vertex vertex3 = graph.addVertex(T.label, "person", "name",
                                          "xyz\\u0003abc", "city", "Hongkong",
                                          "age", 13);
-        graph.tx().commit();
+        this.mayCommitTx();
 
         GraphTraversalSource g = graph.traversal();
 
@@ -8826,7 +9010,7 @@ public class VertexCoreTest extends BaseCoreTest {
         Vertex vertex6 = graph.addVertex(T.label, "person", "name", "6",
                                          "city", "\\u0001",
                                          "age", 15);
-        graph.tx().commit();
+        this.commitTx();
 
         GraphTraversalSource g = graph.traversal();
 
@@ -8928,7 +9112,7 @@ public class VertexCoreTest extends BaseCoreTest {
                                          "city", "Beijing", "age", 23);
         Vertex vertex5 = graph.addVertex(T.label, "person", "name", "秦始皇帝",
                                          "city", "Beijing", "age", 29);
-        graph.tx().commit();
+        this.commitTx();
 
         GraphTraversalSource g = graph.traversal();
 
@@ -8954,6 +9138,11 @@ public class VertexCoreTest extends BaseCoreTest {
         Assert.assertTrue(vertices.contains(vertex4));
     }
 
+    private void init10VerticesAndCommit() {
+        this.init10Vertices();
+        this.commitTx();
+    }
+
     private void init10Vertices() {
         HugeGraph graph = graph();
 
@@ -8975,7 +9164,7 @@ public class VertexCoreTest extends BaseCoreTest {
         graph.addVertex(T.label, "book", "name", "java-4");
         graph.addVertex(T.label, "book", "name", "java-5");
 
-        graph.tx().commit();
+        this.mayCommitTx();
     }
 
     private void init100Books() {
@@ -8985,7 +9174,7 @@ public class VertexCoreTest extends BaseCoreTest {
             graph.addVertex(T.label, "book", "name", "java-" + i, "price", i);
         }
 
-        graph.tx().commit();
+        this.commitTx();
     }
 
     private void init5Persons() {
@@ -9007,7 +9196,7 @@ public class VertexCoreTest extends BaseCoreTest {
                         "city", "Taipei", "age", 21,
                         "birth", Utils.date("2016-01-01 00:00:00.000"));
 
-        graph.tx().commit();
+        this.commitTx();
     }
 
     private void init100Persons() {
@@ -9021,7 +9210,7 @@ public class VertexCoreTest extends BaseCoreTest {
                             "age", i % 11);
         }
 
-        graph.tx().commit();
+        this.commitTx();
     }
 
     private void init5Computers() {
@@ -9045,7 +9234,7 @@ public class VertexCoreTest extends BaseCoreTest {
                         "band", "asus", "cpu", "3.2GHz", "ram", "16GB",
                         "price", 6999);
 
-        graph.tx().commit();
+        this.commitTx();
     }
 
     private void initPageTestData() {
@@ -9131,7 +9320,7 @@ public class VertexCoreTest extends BaseCoreTest {
             graph().addVertex(T.label, "software", T.id, id, "name", "marko",
                               "lang", "java", "price", price);
         }
-        graph().tx().commit();
+        this.commitTx();
     }
 
     private Vertex vertex(String label, String pkName, Object pkValue) {
['hugegraph-test/src/main/java/com/baidu/hugegraph/core/BaseCoreTest.java', 'hugegraph-test/src/main/java/com/baidu/hugegraph/core/EdgeCoreTest.java', 'hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/Condition.java', 'hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java', 'hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java', 'hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java', 'hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPITest.java', 'hugegraph-test/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPITest.java', 'hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java', 'hugegraph-core/src/main/java/com/baidu/hugegraph/backend/page/QueryList.java']