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:10 GMT
Github user aweisberg commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/224#discussion_r188446031
  
    --- Diff: src/java/org/apache/cassandra/service/StorageProxy.java ---
    @@ -344,47 +343,43 @@ private static void recordCasContention(int contentions)
                 casWriteMetrics.contention.update(contentions);
         }
     
    -    private static Predicate<InetAddressAndPort> sameDCPredicateFor(final String
dc)
    +    private static Predicate<Replica> sameDCPredicateFor(final String dc)
         {
             final IEndpointSnitch snitch = DatabaseDescriptor.getEndpointSnitch();
    -        return new Predicate<InetAddressAndPort>()
    -        {
    -            public boolean apply(InetAddressAndPort host)
    -            {
    -                return dc.equals(snitch.getDatacenter(host));
    -            }
    -        };
    +        return replica -> dc.equals(snitch.getDatacenter(replica));
         }
     
         private static PaxosParticipants getPaxosParticipants(TableMetadata metadata, DecoratedKey
key, ConsistencyLevel consistencyForPaxos) throws UnavailableException
         {
             Token tk = key.getToken();
    -        List<InetAddressAndPort> naturalEndpoints = StorageService.instance.getNaturalEndpoints(metadata.keyspace,
tk);
    -        Collection<InetAddressAndPort> pendingEndpoints = StorageService.instance.getTokenMetadata().pendingEndpointsFor(tk,
metadata.keyspace);
    +        ReplicaList naturalReplicas = StorageService.instance.getNaturalReplicas(metadata.keyspace,
tk);
    +        ReplicaList pendingReplicas = new ReplicaList(StorageService.instance.getTokenMetadata().pendingEndpointsFor(tk,
metadata.keyspace));
    --- End diff --
    
    Interesting you end up having to make a copy to a list to convert it from Replicas (actually
a set if you get a non-empty value back).
    



---

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


Mime
View raw message