From cdf1dfe3114b690b8c8a02a89762b8c4c10d9eae Mon Sep 17 00:00:00 2001 From: zhangyi51 Date: Wed, 19 Dec 2018 18:55:51 +0800 Subject: [PATCH] fix bug: index rebuild exceeds 80w limit and 65536 cassandra limit fixed: #291 Change-Id: Iadf1b18c7a1be7a6343ae1fdeffbdb268ee1be90 --- .../com/baidu/hugegraph/backend/tx/GraphTransaction.java | 2 +- .../baidu/hugegraph/backend/tx/IndexableTransaction.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) 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 e81d7946b5..33124e831f 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 @@ -1411,7 +1411,7 @@ private void traverseByLabel(SchemaLabel label, * Query.DEFAULT_CAPACITY to limit elements number per pass */ query.limit(Query.DEFAULT_CAPACITY); - query.capacity(Query.DEFAULT_CAPACITY); + query.capacity(Query.NO_CAPACITY); query.eq(HugeKeys.LABEL, label.id()); int pass = 0; int counter = 0; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/IndexableTransaction.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/IndexableTransaction.java index 39514e99ff..180d9471f4 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/IndexableTransaction.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/IndexableTransaction.java @@ -57,6 +57,15 @@ protected void commit2Backend() { this.commitMutation2Backend(mutation, txMutation); } + @Override + public void commitIfGtSize(int size) throws BackendException { + int totalSize = this.mutationSize() + + this.indexTransaction().mutationSize(); + if (totalSize >= size) { + this.commit(); + } + } + @Override public void rollback() throws BackendException { try {