fix(pd): Ensure range attribute thread safety by haohao0103 · Pull Request #2641 · apache/hugegraph
close #2634
Added a custom SynchronizedRangeMap that provides thread safe put/get and other methods to ensure thread safety of GraphCache range attr
labels
Aug 14, 2024Codecov 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.
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; |
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(); | |||
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?
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
VGalaxies
changed the title
fix(pd):Ensure range attribute thread safety
fix(pd): Ensure range attribute thread safety
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters