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(core): edge cache not clear when update or delete associated vertex #1780

Merged
merged 7 commits into from
Mar 14, 2022

Conversation

sunlujing
Copy link
Contributor

@sunlujing sunlujing commented Mar 12, 2022

  1. fix the bug when vertex updated, but the edge cache associated with that vertex was not updated. Here we simply clear all edge cache when  any vertex changes.
  2. add two test case for the fixing

fix #1779

1. fix the bug when vertex updated, but the edge cache associated with that vertex was not updated. Here we simply clear all edge cache when  any vertex changes.
1.add two test case for the fixing
1. fix the bug when vertex updated, but the edge cache associated with that vertex was not updated. Here we simply clear all edge cache when  any vertex changes.
@CLAassistant
Copy link

CLAassistant commented Mar 12, 2022

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Mar 14, 2022

Codecov Report

Merging #1780 (fdbe63a) into master (5bb860f) will increase coverage by 3.93%.
The diff coverage is 50.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1780      +/-   ##
============================================
+ Coverage     66.86%   70.79%   +3.93%     
+ Complexity      972      970       -2     
============================================
  Files           443      443              
  Lines         37748    37749       +1     
  Branches       5383     5384       +1     
============================================
+ Hits          25240    26726    +1486     
+ Misses         9784     8302    -1482     
+ Partials       2724     2721       -3     
Impacted Files Coverage Δ
...ugegraph/backend/cache/CachedGraphTransaction.java 85.48% <50.00%> (+4.40%) ⬆️
...va/com/baidu/hugegraph/util/collection/IntSet.java 73.61% <0.00%> (-1.28%) ⬇️
...m/baidu/hugegraph/backend/tx/GraphTransaction.java 80.16% <0.00%> (+0.10%) ⬆️
...du/hugegraph/backend/tx/GraphIndexTransaction.java 83.72% <0.00%> (+0.21%) ⬆️
...du/hugegraph/traversal/optimize/TraversalUtil.java 62.60% <0.00%> (+0.21%) ⬆️
.../baidu/hugegraph/backend/query/ConditionQuery.java 85.14% <0.00%> (+0.24%) ⬆️
...du/hugegraph/schema/builder/IndexLabelBuilder.java 88.69% <0.00%> (+0.28%) ⬆️
.../com/baidu/hugegraph/auth/StandardAuthManager.java 92.81% <0.00%> (+0.32%) ⬆️
...idu/hugegraph/schema/builder/EdgeLabelBuilder.java 83.62% <0.00%> (+0.34%) ⬆️
...a/com/baidu/hugegraph/backend/query/Condition.java 77.97% <0.00%> (+0.36%) ⬆️
... and 109 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 5bb860f...fdbe63a. Read the comment docs.

Copy link
Member

@imbajin imbajin left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution, a little comments for it.

For code style problems, if you use IDEA as your IDE, you can directly import our code style configuration file.



@Test
public void testClearEdgeCacheWhenDeleteVertex(){
Copy link
Member

Choose a reason for hiding this comment

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

testClearEdgeCacheXx --> testEdgeCacheClearXx or testEdgeCacheEmptyXx seems better, same as another test method

Comment on lines 397 to 399
// Update edge cache if any vertex or edge change
// for vertex change, the edge associated with that vertex should also be updated
// here we just clear all the edge cache , before we use a more precise strategy
Copy link
Member

Choose a reason for hiding this comment

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

some typo:

  • we could use /* xx */ and let them looks like a paragraph
  • vertex change --> vertex changed
  • here xx, before xxx --> Before xx. now we just xx

Comment on lines 22 to 23
import com.baidu.hugegraph.structure.HugeEdge;
import com.baidu.hugegraph.structure.HugeVertexProperty;
Copy link
Member

Choose a reason for hiding this comment

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

we could move the import lines after 35, recommend using our code-style config to avoid these changes~
image

Comment on lines 73 to 76
.idStrategy(IdStrategy.CUSTOMIZE_NUMBER)
.properties("name").nullableKeys("name")
.checkExist(false)
.create();
Copy link
Member

Choose a reason for hiding this comment

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

we could keep original format. so as other lines (align lines)

Copy link
Contributor

@javeme javeme left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution! The code logic looks good, can we adjust the code style?
You can refer to the code style guide: https://github.com/hugegraph/hugegraph-doc/wiki/HugeGraph%E4%BB%A3%E7%A0%81%E9%A3%8E%E6%A0%BC%E6%8C%87%E5%8D%97

}

Copy link
Contributor

Choose a reason for hiding this comment

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

can remove useless line

Comment on lines 222 to 223


Copy link
Contributor

Choose a reason for hiding this comment

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

can remove useless line

}

@Test
public void testClearEdgeCacheWhenUpdateVertex(){
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for contributing test cases

format code using  hugegraph code style
format code using hugegraph code style
@sunlujing
Copy link
Contributor Author

have reformated code style

/*
* Update edge cache if any vertex or edge changed
* For vertex change, the edges linked with should also be updated
* Before we use a more precise strategy,now we just clear all the edge cache
Copy link
Member

@imbajin imbajin Mar 14, 2022

Choose a reason for hiding this comment

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

enhance to--> Before we find a more precise strategy, just clear all the edge cache now (expect a space after ,)

PS: For convenience, u can edit the file directly on github page 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@imbajin imbajin changed the title Fix edge cache issue fix: edge cache not clear when update or delete associated vertex Mar 14, 2022
@imbajin imbajin changed the title fix: edge cache not clear when update or delete associated vertex fix(core): edge cache not clear when update or delete associated vertex Mar 14, 2022
imbajin
imbajin previously approved these changes Mar 14, 2022
javeme
javeme previously approved these changes Mar 14, 2022
Comment on lines 143 to 144


Copy link
Contributor

Choose a reason for hiding this comment

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

one blank line is ok

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@sunlujing sunlujing dismissed stale reviews from javeme and imbajin via fdbe63a March 14, 2022 07:18
@github-actions
Copy link

github-actions bot commented Mar 14, 2022

CLA Assistant Lite bot Good! All Contributors have signed the CLA.

@sunlujing
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@sunlujing
Copy link
Contributor Author

recheck

@javeme javeme merged commit 58b3ebe into apache:master Mar 14, 2022
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.

[Bug] edge-cache-clear should account for vertex update
4 participants