Github user ifesdjeen commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/224#discussion_r197135241
  
    --- Diff: src/java/org/apache/cassandra/service/StorageProxy.java ---
    @@ -503,14 +498,14 @@ private static void sendCommit(Commit commit, 
Iterable<InetAddressAndPort> repli
                 MessagingService.instance().sendOneWay(message, target);
         }
     
    -    private static PrepareCallback preparePaxos(Commit toPrepare, 
List<InetAddressAndPort> endpoints, int requiredParticipants, ConsistencyLevel 
consistencyForPaxos, long queryStartNanoTime)
    +    private static PrepareCallback preparePaxos(Commit toPrepare, 
ReplicaList replicas, int requiredParticipants, ConsistencyLevel 
consistencyForPaxos, long queryStartNanoTime)
         throws WriteTimeoutException
         {
             PrepareCallback callback = new 
PrepareCallback(toPrepare.update.partitionKey(), toPrepare.update.metadata(), 
requiredParticipants, consistencyForPaxos, queryStartNanoTime);
             MessageOut<Commit> message = new 
MessageOut<Commit>(MessagingService.Verb.PAXOS_PREPARE, toPrepare, 
Commit.serializer);
    -        for (InetAddressAndPort target : endpoints)
    +        for (Replica replica: replicas)
             {
    -            if (canDoLocalRequest(target))
    +            if (canDoLocalRequest(replica.getEndpoint()))
    --- End diff --
    
    `canDoLocalRequest` can receive Replica (or we can move it to replica). 
This will spare many `getEndpoint` calls where this method is called.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to