-
Notifications
You must be signed in to change notification settings - Fork 527
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(pd): Ensure range attribute thread safety #2641
Conversation
Codecov ReportAttention: Patch coverage is
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. |
@@ -39,7 +41,7 @@ public class GraphCache { | |||
private ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); | |||
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; |
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.
nice catch
@@ -39,7 +41,7 @@ public class GraphCache { | |||
private ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); |
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.
@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 |
close #2634
Added a custom SynchronizedRangeMap that provides thread safe put/get and other methods to ensure thread safety of GraphCache range attr