Github user bdeggleston commented on a diff in the pull request:
https://github.com/apache/cassandra/pull/224#discussion_r189091280
--- Diff:
src/java/org/apache/cassandra/locator/AbstractReplicationStrategy.java ---
@@ -202,61 +204,63 @@ private Keyspace getKeyspace()
*
* @return the replication factor
*/
- public abstract int getReplicationFactor();
+ public abstract ReplicationFactor getReplicationFactor();
/*
* NOTE: this is pretty inefficient. also the inverse
(getRangeAddresses) below.
* this is fine as long as we don't use this on any critical path.
* (fixing this would probably require merging tokenmetadata into
replicationstrategy,
* so we could cache/invalidate cleanly.)
*/
- public Multimap<InetAddressAndPort, Range<Token>>
getAddressRanges(TokenMetadata metadata)
+ public ReplicaMultimap<InetAddressAndPort, ReplicaSet>
getAddressReplicas(TokenMetadata metadata)
{
- Multimap<InetAddressAndPort, Range<Token>> map =
HashMultimap.create();
+ ReplicaMultimap<InetAddressAndPort, ReplicaSet> map =
ReplicaMultimap.set();
for (Token token : metadata.sortedTokens())
{
Range<Token> range = metadata.getPrimaryRangeFor(token);
- for (InetAddressAndPort ep : calculateNaturalEndpoints(token,
metadata))
+ for (Replica replica : calculateNaturalReplicas(token,
metadata))
{
- map.put(ep, range);
+ Preconditions.checkState(range.equals(replica.getRange())
|| this instanceof LocalStrategy);
--- End diff --
added comment
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]