-
Notifications
You must be signed in to change notification settings - Fork 525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix left range index #1498
Fix left range index #1498
Conversation
hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/config/CoreOptions.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
@@ -444,7 +444,7 @@ public boolean test(HugeElement element) { | |||
return false; | |||
} | |||
|
|||
if (hasErrorMatchedRangeIndex(element, cond)) { | |||
if (!validRangeIndex(element, cond)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there the same issue with search index and union index?
can remove the empty line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我的理解search index在搜索的时候有过滤,应该还好
union index 需要验证下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
union index 看起来是需要解决这个问题的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.validRangeIndex()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
union index 看起来是需要解决这个问题的。
验证,union index 可以正确过滤,见新增的测试用例
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
@@ -444,7 +444,7 @@ public boolean test(HugeElement element) { | |||
return false; | |||
} | |||
|
|||
if (hasErrorMatchedRangeIndex(element, cond)) { | |||
if (!validRangeIndex(element, cond)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
union index 看起来是需要解决这个问题的。
@@ -444,7 +444,7 @@ public boolean test(HugeElement element) { | |||
return false; | |||
} | |||
|
|||
if (hasErrorMatchedRangeIndex(element, cond)) { | |||
if (!validRangeIndex(element, cond)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.validRangeIndex()
|
||
public static class Element2IndexValueMap { | ||
|
||
Id propertyId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set private final
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
e224874
to
fc72dd7
Compare
there are too many logs like:
|
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
@@ -613,6 +613,7 @@ private IdHolder doIndexQueryBatch(IndexLabel indexLabel, | |||
this.removeExpiredIndexIfNeeded(index, query.showExpired()); | |||
ids.addAll(index.elementIds()); | |||
Query.checkForceCapacity(ids.size()); | |||
recordIndexValue(query, index, indexLabel); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.recordIndexValue
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java
Outdated
Show resolved
Hide resolved
f6fb0f0
to
1a503fe
Compare
Codecov Report
@@ Coverage Diff @@
## master #1498 +/- ##
============================================
+ Coverage 58.07% 62.86% +4.79%
- Complexity 6244 6680 +436
============================================
Files 417 417
Lines 34293 34438 +145
Branches 4735 4764 +29
============================================
+ Hits 19914 21650 +1736
+ Misses 12310 10549 -1761
- Partials 2069 2239 +170
Continue to review full report at Codecov.
|
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java
Show resolved
Hide resolved
0cd62de
to
30ea45d
Compare
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/query/ConditionQuery.java
Show resolved
Hide resolved
29bb384
to
c01c767
Compare
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java
Show resolved
Hide resolved
hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java
Show resolved
Hide resolved
hugegraph-test/src/main/java/com/baidu/hugegraph/core/VertexCoreTest.java
Outdated
Show resolved
Hide resolved
bf512d7
to
13926c4
Compare
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphIndexTransaction.java
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
hugegraph-core/src/main/java/com/baidu/hugegraph/backend/tx/GraphTransaction.java
Outdated
Show resolved
Hide resolved
@@ -1620,6 +1608,23 @@ private void lockForUpdateProperty(SchemaLabel schemaLabel, | |||
} | |||
} | |||
|
|||
private void removeLeftIndexIfNeeded(Map<Id, HugeVertex> vertices) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can mock and test it? use Whitebox to set removeLeftIndexOnOverwrite=true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add test, but seems not work
failure test of cassandra backend: Error: Tests run: 713, Failures: 1, Errors: 0, Skipped: 21, Time elapsed: 500.427 s <<< FAILURE! - in com.baidu.hugegraph.core.CoreTestSuite
Error: testRemoveLeftRangeIndex(com.baidu.hugegraph.core.VertexCoreTest) Time elapsed: 2.742 s <<< FAILURE!
java.lang.AssertionError: expected:<10> but was:<6>
at com.baidu.hugegraph.core.VertexCoreTest.testRemoveLeftRangeIndex(VertexCoreTest.java:536)
2021-07-28 11:37:05 [hugegraph-shutdown] [INFO] c.b.h.HugeGraph - HugeGraph is shutting down
Error: -28 11:37:05 [hugegraph-shutdown] [ERROR] c.b.h.HugeGraph - Error while shutdown
java.lang.AssertionError: 2
at com.baidu.hugegraph.task.TaskManager.shutdown(TaskManager.java:180) ~[classes/:?]
at com.baidu.hugegraph.HugeFactory.shutdown(HugeFactory.java:140) ~[classes/:?]
at com.baidu.hugegraph.HugeFactory.lambda$static$0(HugeFactory.java:52) ~[classes/:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_292]
Error: Exception in thread "hugegraph-shutdown" com.baidu.hugegraph.HugeException: Failed to shutdown
at com.baidu.hugegraph.HugeFactory.shutdown(HugeFactory.java:144)
at com.baidu.hugegraph.HugeFactory.lambda$static$0(HugeFactory.java:52)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.AssertionError: 2
at com.baidu.hugegraph.task.TaskManager.shutdown(TaskManager.java:180)
at com.baidu.hugegraph.HugeFactory.shutdown(HugeFactory.java:140)
... 2 more
[INFO]
[INFO] Results:
[INFO]
Error: Failures:
Error: VertexCoreTest.testRemoveLeftRangeIndex:536 expected:<10> but was:<6>
[INFO]
Error: Tests run: 713, Failures: 1, Errors: 0, Skipped: 21 |
fixed |
fixed #1495