You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "beobal (via GitHub)" <gi...@apache.org> on 2024/06/10 14:00:40 UTC
[PR] Support querying LocalStrategy tables with any partitioner [cassandra]
beobal opened a new pull request, #3363:
URL: https://github.com/apache/cassandra/pull/3363
patch by Sam Tunnicliffe; reviewed by XXX for CASSANDRA-19692
Thanks for sending a pull request! Here are some tips if you're new here:
* Ensure you have added or run the [appropriate tests](https://cassandra.apache.org/_/development/testing.html) for your PR.
* Be sure to keep the PR description updated to reflect all changes.
* Write your PR title to summarize what this PR proposes.
* If possible, provide a concise example to reproduce the issue for a faster review.
* Read our [contributor guidelines](https://cassandra.apache.org/_/development/index.html)
* If you're making a documentation change, see our [guide to documentation contribution](https://cassandra.apache.org/_/development/documentation.html)
Commit messages should follow the following format:
```
<One sentence description, usually Jira title or CHANGES.txt summary>
<Optional lengthier description (context on patch)>
patch by <Authors>; reviewed by <Reviewers> for CASSANDRA-#####
Co-authored-by: Name1 <email1>
Co-authored-by: Name2 <email2>
```
The [Cassandra Jira](https://issues.apache.org/jira/projects/CASSANDRA/issues/)
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] Support querying LocalStrategy tables with any partitioner [cassandra]
Posted by "krummas (via GitHub)" <gi...@apache.org>.
krummas commented on code in PR #3363:
URL: https://github.com/apache/cassandra/pull/3363#discussion_r1634988357
##########
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:
this block could be:
`return perPartitionerRanges.computeIfAbsent(partitioner, EntireRange::new);`
##########
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:
I think this should be an IdentityHashMap since we don't have .equals and .hashCode on (all) the IPartitioner implementations - better to be explicit about what we're caching
it could also be `final`
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] Support querying LocalStrategy tables with any partitioner [cassandra]
Posted by "beobal (via GitHub)" <gi...@apache.org>.
beobal closed pull request #3363: Support querying LocalStrategy tables with any partitioner
URL: https://github.com/apache/cassandra/pull/3363
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] Support querying LocalStrategy tables with any partitioner [cassandra]
Posted by "beobal (via GitHub)" <gi...@apache.org>.
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] Support querying LocalStrategy tables with any partitioner [cassandra]
Posted by "beobal (via GitHub)" <gi...@apache.org>.
beobal commented on PR #3363:
URL: https://github.com/apache/cassandra/pull/3363#issuecomment-2162345984
Rebased and pushed with review fixes
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org