Source:
<code>private static PaxosParticipants getPaxosParticipants(TableMetadata metadata, DecoratedKey key, ConsistencyLevel consistencyForPaxos) throws UnavailableException { Token tk = key.getToken(); ReplicaList naturalReplicas = StorageService.instance.getNaturalReplicas(metadata.keyspace, tk); <START> ReplicaList pendingReplicas = new ReplicaList(StorageService.instance.getTokenMetadata().pendingEndpointsFor(tk, metadata.keyspace)); <END> if (consistencyForPaxos == ConsistencyLevel.LOCAL_SERIAL) { String localDc = DatabaseDescriptor.getEndpointSnitch().getDatacenter(FBUtilities.getBroadcastAddressAndPort()); Predicate<Replica> isLocalDc = sameDCPredicateFor(localDc); naturalReplicas = ReplicaList.immutableCopyOf(naturalReplicas.filter(isLocalDc)); pendingReplicas = ReplicaList.immutableCopyOf(pendingReplicas.filter(isLocalDc)); } int participants = pendingReplicas.size() + naturalReplicas.size(); int requiredParticipants = participants / 2 + 1; Replicas concatenated = Replicas.concatNaturalAndPending(naturalReplicas, pendingReplicas); ReplicaList liveReplicas = ReplicaList.immutableCopyOf(Replicas.filter(concatenated, IAsyncCallback.isReplicaAlive)); if (liveReplicas.size() < requiredParticipants) throw new UnavailableException(consistencyForPaxos, requiredParticipants, liveReplicas.size()); if (pendingReplicas.size() > 1) throw new UnavailableException(String.format("Cannot perform LWT operation as there is more than one (%d) pending range movement", pendingReplicas.size()), consistencyForPaxos, participants + 1, liveReplicas.size()); return new PaxosParticipants(liveReplicas, requiredParticipants); }</code><technical_language>Interesting end a copy a list convert Replicas (actually a set if get a non-empty back)</technical_language>

Target:
private static PaxosParticipants getPaxosParticipants(TableMetadata metadata, DecoratedKey key, ConsistencyLevel consistencyForPaxos) throws UnavailableException { Token tk = key.getToken(); ReplicaList naturalReplicas = StorageService.instance.getNaturalReplicas(metadata.keyspace, tk); ReplicaList pendingReplicas = new ReplicaList(StorageService.instance.getTokenMetadata().pendingEndpointsFor(tk, metadata.keyspace)); if (consistencyForPaxos == ConsistencyLevel.LOCAL_SERIAL) { String localDc = DatabaseDescriptor.getEndpointSnitch().getDatacenter(FBUtilities.getBroadcastAddressAndPort()); Predicate<Replica> isLocalDc = sameDCPredicateFor(localDc); naturalReplicas = ReplicaList.immutableCopyOf(naturalReplicas.filter(isLocalDc)); pendingReplicas = ReplicaList.immutableCopyOf(pendingReplicas.filter(isLocalDc)); } int participants = pendingReplicas.size() + naturalReplicas.size(); int requiredParticipants = participants / 2 + 1; ReplicaCollection concatenated = Replicas.concatNaturalAndPending(naturalReplicas, pendingReplicas); ReplicaList liveReplicas = ReplicaList.immutableCopyOf(Replicas.filter(concatenated, IAsyncCallback.isReplicaAlive)); if (liveReplicas.size() < requiredParticipants) throw new UnavailableException(consistencyForPaxos, requiredParticipants, liveReplicas.size()); if (pendingReplicas.size() > 1) throw new UnavailableException(String.format("Cannot perform LWT operation as there is more than one (%d) pending range movement", pendingReplicas.size()), consistencyForPaxos, participants + 1, liveReplicas.size()); return new PaxosParticipants(liveReplicas, requiredParticipants); }