Skip to content

fix(pd): Ensure range attribute thread safety#2641

Merged
VGalaxies merged 2 commits intoapache:masterfrom
haohao0103:alan-master-2634
Sep 25, 2024
Merged

fix(pd): Ensure range attribute thread safety#2641
VGalaxies merged 2 commits intoapache:masterfrom
haohao0103:alan-master-2634

Conversation

@haohao0103
Copy link
Copy Markdown
Collaborator

close #2634
Added a custom SynchronizedRangeMap that provides thread safe put/get and other methods to ensure thread safety of GraphCache range attr

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. pd PD module labels Aug 14, 2024
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 0% with 22 lines in your changes missing coverage. Please review.

Project coverage is 34.98%. Comparing base (1c577de) to head (dfc9ce6).
Report is 231 commits behind head on master.

Files with missing lines Patch % Lines
...ava/org/apache/hugegraph/pd/common/GraphCache.java 0.00% 22 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (1c577de) and HEAD (dfc9ce6). Click for more details.

HEAD has 3 uploads less than BASE
Flag BASE (1c577de) HEAD (dfc9ce6)
4 1
Additional details and impacted files
@@              Coverage Diff              @@
##             master    #2641       +/-   ##
=============================================
- Coverage     45.35%   34.98%   -10.37%     
+ Complexity      496      383      -113     
=============================================
  Files           719      719               
  Lines         58465    58486       +21     
  Branches       7495     7495               
=============================================
- Hits          26514    20464     -6050     
- Misses        29230    35763     +6533     
+ Partials       2721     2259      -462     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

private Map<Integer, AtomicBoolean> state = new ConcurrentHashMap<>();
private Map<Integer, Partition> partitions = new ConcurrentHashMap<>();
private RangeMap<Long, Integer> range = TreeRangeMap.create();
private RangeMap<Long, Integer> range = new SynchronizedRangeMap<Long, Integer>().rangeMap;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice catch

@@ -39,7 +41,7 @@ public class GraphCache {
private ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@imbajin Can we improve and avoid this lombok.Data programming style in the future, which will cause internal members to be modified arbitrarily by external class?

@github-actions
Copy link
Copy Markdown

Due to the lack of activity, the current pr is marked as stale and will be closed after 180 days, any update will remove the stale label

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 24, 2024
@imbajin imbajin requested a review from VGalaxies September 24, 2024 07:48
@VGalaxies VGalaxies changed the title fix(pd):Ensure range attribute thread safety fix(pd): Ensure range attribute thread safety Sep 25, 2024
@VGalaxies VGalaxies merged commit a657ce5 into apache:master Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

inactive lgtm This PR has been approved by a maintainer pd PD module size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug] PD GraphCache range attribute has a missing coverage range of 0-65535

4 participants