fix: check uncommit due gremlin partition test silently fails (#2065)

This commit is contained in:
Jermy Li 2023-01-04 23:18:55 +08:00 committed by GitHub
parent 93614cf29d
commit 7efcf879c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

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