Skip to content
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 rocksdb oom with g.V().hasLabel().count() #823

Merged
merged 26 commits into from
Mar 13, 2020
Merged

Conversation

javeme
Copy link
Contributor

@javeme javeme commented Jan 9, 2020

fix #793
rebase for #798

@codecov
Copy link

codecov bot commented Jan 9, 2020

Codecov Report

Merging #823 into master will increase coverage by 0.09%.
The diff coverage is 74.27%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #823      +/-   ##
============================================
+ Coverage     72.13%   72.23%   +0.09%     
- Complexity     4456     4486      +30     
============================================
  Files           287      287              
  Lines         21227    21407     +180     
  Branches       2992     3017      +25     
============================================
+ Hits          15313    15463     +150     
- Misses         4401     4433      +32     
+ Partials       1513     1511       -2     
Impacted Files Coverage Δ Complexity Δ
...api/src/main/java/com/baidu/hugegraph/api/API.java 66.29% <0.00%> (-1.53%) 0.00 <0.00> (ø)
...ugegraph/api/traversers/FusiformSimilarityAPI.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
.../baidu/hugegraph/backend/query/ConditionQuery.java 85.97% <ø> (+0.70%) 97.00 <0.00> (+1.00)
...ava/com/baidu/hugegraph/backend/query/IdQuery.java 97.22% <ø> (-0.15%) 13.00 <0.00> (-1.00)
...du/hugegraph/traversal/optimize/TraversalUtil.java 67.59% <0.00%> (+0.69%) 82.00 <0.00> (ø)
...a/com/baidu/hugegraph/variables/HugeVariables.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...egraph/backend/store/mysql/MysqlEntryIterator.java 79.10% <0.00%> (ø) 17.00 <0.00> (ø)
...du/hugegraph/backend/cache/CachedBackendStore.java 9.67% <33.33%> (ø) 0.00 <0.00> (ø)
...n/java/com/baidu/hugegraph/structure/HugeEdge.java 74.40% <50.00%> (-0.16%) 73.00 <0.00> (ø)
...java/com/baidu/hugegraph/structure/HugeVertex.java 78.69% <50.00%> (-0.10%) 76.00 <0.00> (ø)
... and 41 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f1f1d0e...0808022. Read the comment docs.

@javeme
Copy link
Contributor Author

javeme commented Jan 9, 2020

TODO: let tx.queryXX() return CIter

@javeme
Copy link
Contributor Author

javeme commented Jan 15, 2020

TODO: add gremlin job test with g.V(), g.V().hasLabel(xx), g.E(), g.E().hasLabel(xx)

@@ -76,6 +76,9 @@ protected final boolean fetch() {
} else if (merged == this.current) {
// The next entry belongs to the current entry
assert this.current != null;
if (this.sizeOf(this.current) >= INLINE_BATCH_SIZE) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as cassandra and hbase


/**
* For paging situation
* @param query original query
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'original query' align

javeme added 20 commits March 4, 2020 23:54
Change-Id: I99c9471d75d320f3980d38f291d75c0b7237adfd
Change-Id: Iae0716e4624e8389b9c3bb74c8f784c54d29d0ba
Change-Id: I3f8da8b39d64dfc8a3aa9e888c6c07feace0878f
Change-Id: I4a14339548b3906f6be024293a8c3bb0e76d65e7
Change-Id: I98047052ceb791eba5e3d915cc2bfeacc2186a01
Change-Id: I75cd3d4bb66bfbbc584033b8f279c6781bf125cc
Change-Id: I625ff7d826f3f3f85ebeff72a94d70e416aee242
Change-Id: I7f4c03d17ad584b97142a07fa10d04868f5be53a
Change-Id: Ib030a2758e73b4c9a9fccf1e310875d58610e4de
Change-Id: I0d178d44ab3b28f1add736eac00fecca06fb8e47
Change-Id: I6851863901143b6b607a7ad8ebc611c1807a17ae
Change-Id: I3a96ade9563a56b8cdd840aaccb7664922ac6950
Change-Id: If8561419d87642986a2f942c1998d78070617163
Change-Id: Id1dd6973d0209598c710069128690e1f58e21011
Change-Id: I0e5a590aafe34f53489901b9c595964c26cde977
Change-Id: If196b2450addbe62cf92fa433b661e1bc28c16cc
Change-Id: I5e5d1e05800ce9763831a49962d84b9a4944d7bb
Change-Id: Ia578154ef5c58dd3fb3a11d779180a68df9f28fe
Change-Id: Id309f7101e81a643017de3e94c01eceddf52fa8d
Change-Id: I118d49b45467eaefea4b0017b84bbc158692f17b
Change-Id: I4c772747c06890257743283ff5559ac84efbe8d9
Change-Id: I632b9f847c55249c96d6aabfa6e037d317124fcb
Change-Id: I773df0769bb25e139e3242b5c8436fc5fd1eec8d
@Test
public void testToStringOfIdRangeQuery() {
IdRangeQuery query = new IdRangeQuery(HugeType.EDGE,
IdGenerator.of(1),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

align

@@ -1211,6 +1275,10 @@ private static boolean hasNullableProp(HugeElement element, Id key) {
return indexLabels;
}

private static void increaseLimit(Query query) {
query.limit(query.limit() * 2L + 8L);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the basis?

return null;
}

public Query asQuery() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asJointQuery maybe clearer

Change-Id: Ib41ae85b65f95707386e3c5df5ed4286580009c1
Linary
Linary previously approved these changes Mar 10, 2020
vertices.add(vertex);
// Generally there are not too much data with id query
ListIterator<HugeVertex> listIterator = QueryResults.toList(rs);
for (HugeVertex vertex :listIterator.list()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add empty after ":"

if (dir == Directions.OUT && vertex.equals(edge.outVertex()) ||
dir == Directions.IN && vertex.equals(edge.inVertex())) {
list.add(edge);
dir == Directions.IN && vertex.equals(edge.inVertex())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete empty

@@ -48,6 +51,7 @@
private HugeType resultType;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

capacityContext

if (this.exhausted) {
return false;
}
boolean hasNext= this.entries.hasNext();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add empty

public PageIds fetchNext(String page, long batchSize) {
E.checkArgument(page == null,
"Not support page parameter by BatchIdHolder");
E.checkArgument(batchSize >= 0L,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

batchSize might be 0?

Copy link
Contributor Author

@javeme javeme Mar 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it's 0 when hit the last page, and then set exhausted true

T result = iterator.next();
if (iterator.hasNext()) {
throw new HugeException(
"Expect just one result but got two: [%s, %s]",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expect just one result but got at least two: [%s, %s, ...]

Change-Id: I63c2adec8365e481682bd511dea6c6849a3d5114
Linary
Linary previously approved these changes Mar 12, 2020
Change-Id: I13daaa513b2f5ddc69bcae4d548f263ad1f5b08d
@javeme javeme merged commit 9166c26 into master Mar 13, 2020
@javeme javeme deleted the fix-rocksdb-oom-rebase branch March 13, 2020 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gremlin计数 HugeGraph OOM
3 participants