cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aweisberg <...@git.apache.org>
Subject [GitHub] cassandra pull request #224: 14405 replicas
Date Wed, 16 May 2018 17:06:05 GMT
Github user aweisberg commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/224#discussion_r188058733
  
    --- 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 --
    
    Can you explain this check? Why would LocalStrategy not have the ranges match?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message