beobal commented on code in PR #3363:
URL: https://github.com/apache/cassandra/pull/3363#discussion_r1635992574
##########
src/java/org/apache/cassandra/locator/LocalStrategy.java:
##########
@@ -56,16 +59,36 @@ public ReplicationFactor getReplicationFactor()
return RF;
}
+ private EntireRange getRange(IPartitioner partitioner)
+ {
+ // No need to synchronize here. In the unlikely event of a race, it's
+ // safe and cheap to create duplicates and overwrite in the cache.
+ EntireRange range = perPartitionerRanges.get(partitioner);
Review Comment:
I did it this way as `ConcurrentHashMap::computeIfAbsent` can have a small
penalty in blocking other, non contending updates, but since switching to
`IdentityHashMap` that's not a concern.
##########
src/java/org/apache/cassandra/locator/LocalStrategy.java:
##########
@@ -33,6 +34,8 @@
public class LocalStrategy extends SystemStrategy
{
private static final ReplicationFactor RF = ReplicationFactor.fullOnly(1);
+ private static Map<IPartitioner, EntireRange> perPartitionerRanges = new
ConcurrentHashMap<>();
Review Comment:
good points, amended.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]