protected RangeForQuery computeNext() { if (!ranges.hasNext()) return endOfData(); AbstractBounds<PartitionPosition> range = ranges.next(); List<InetAddress> liveEndpoints = getLiveSortedEndpoints(keyspace, range.right); return new RangeForQuery(range, liveEndpoints, consistency.filterForQuery(keyspace, liveEndpoints)); } }
protected RangeForQuery computeNext() { if (!ranges.hasNext()) { return endOfData(); } AbstractBounds<PartitionPosition> range = ranges.next(); List<InetAddress> liveEndpoints = StorageProxy.getLiveSortedEndpoints(keyspace, range.right); return new RangeForQuery(range, liveEndpoints, consistency.filterForQuery(keyspace, liveEndpoints)); } }
protected RangeForQuery computeNext() { if (!ranges.hasNext()) return endOfData(); AbstractBounds<PartitionPosition> range = ranges.next(); List<InetAddress> liveEndpoints = getLiveSortedEndpoints(keyspace, range.right); return new RangeForQuery(range, liveEndpoints, consistency.filterForQuery(keyspace, liveEndpoints)); } }
protected RangeForQuery computeNext() { if (!ranges.hasNext()) return endOfData(); AbstractBounds<PartitionPosition> range = ranges.next(); List<InetAddress> liveEndpoints = getLiveSortedEndpoints(keyspace, range.right); return new RangeForQuery(range, liveEndpoints, consistency.filterForQuery(keyspace, liveEndpoints)); } }
public List<InetAddress> filterForQuery(Keyspace keyspace, List<InetAddress> liveEndpoints, ReadRepairDecision readRepair) { /* * Endpoints are expected to be restricted to live replicas, sorted by snitch preference. * For LOCAL_QUORUM, move local-DC replicas in front first as we need them there whether * we do read repair (since the first replica gets the data read) or not (since we'll take * the blockFor first ones). */ if (isDCLocal) Collections.sort(liveEndpoints, DatabaseDescriptor.getLocalComparator()); switch (readRepair) { case NONE: return liveEndpoints.subList(0, Math.min(liveEndpoints.size(), blockFor(keyspace))); case GLOBAL: return liveEndpoints; case DC_LOCAL: List<InetAddress> local = new ArrayList<InetAddress>(); List<InetAddress> other = new ArrayList<InetAddress>(); for (InetAddress add : liveEndpoints) { if (isLocal(add)) local.add(add); else other.add(add); } // check if blockfor more than we have localep's int blockFor = blockFor(keyspace); if (local.size() < blockFor)
public List<InetAddress> filterForQuery(Keyspace keyspace, List<InetAddress> liveEndpoints, ReadRepairDecision readRepair) { /* * If we are doing an each quorum query, we have to make sure that the endpoints we select * provide a quorum for each data center. If we are not using a NetworkTopologyStrategy, * we should fall through and grab a quorum in the replication strategy. */ if (this == EACH_QUORUM && keyspace.getReplicationStrategy() instanceof NetworkTopologyStrategy) return filterForEachQuorum(keyspace, liveEndpoints, readRepair); /* * Endpoints are expected to be restricted to live replicas, sorted by snitch preference. * For LOCAL_QUORUM, move local-DC replicas in front first as we need them there whether * we do read repair (since the first replica gets the data read) or not (since we'll take * the blockFor first ones). */ if (isDCLocal) Collections.sort(liveEndpoints, DatabaseDescriptor.getLocalComparator()); switch (readRepair) { case NONE: return liveEndpoints.subList(0, Math.min(liveEndpoints.size(), blockFor(keyspace))); case GLOBAL: return liveEndpoints; case DC_LOCAL: List<InetAddress> local = new ArrayList<InetAddress>(); List<InetAddress> other = new ArrayList<InetAddress>(); for (InetAddress add : liveEndpoints) {
public List<InetAddress> filterForQuery(Keyspace keyspace, List<InetAddress> liveEndpoints, ReadRepairDecision readRepair) { /* * If we are doing an each quorum query, we have to make sure that the endpoints we select * provide a quorum for each data center. If we are not using a NetworkTopologyStrategy, * we should fall through and grab a quorum in the replication strategy. */ if (this == EACH_QUORUM && keyspace.getReplicationStrategy() instanceof NetworkTopologyStrategy) return filterForEachQuorum(keyspace, liveEndpoints, readRepair); /* * Endpoints are expected to be restricted to live replicas, sorted by snitch preference. * For LOCAL_QUORUM, move local-DC replicas in front first as we need them there whether * we do read repair (since the first replica gets the data read) or not (since we'll take * the blockFor first ones). */ if (isDCLocal) Collections.sort(liveEndpoints, DatabaseDescriptor.getLocalComparator()); switch (readRepair) { case NONE: return liveEndpoints.subList(0, Math.min(liveEndpoints.size(), blockFor(keyspace))); case GLOBAL: return liveEndpoints; case DC_LOCAL: List<InetAddress> local = new ArrayList<InetAddress>(); List<InetAddress> other = new ArrayList<InetAddress>(); for (InetAddress add : liveEndpoints) {
public List<InetAddress> filterForQuery(Keyspace keyspace, List<InetAddress> liveEndpoints, ReadRepairDecision readRepair) { /* * If we are doing an each quorum query, we have to make sure that the endpoints we select * provide a quorum for each data center. If we are not using a NetworkTopologyStrategy, * we should fall through and grab a quorum in the replication strategy. */ if (this == EACH_QUORUM && keyspace.getReplicationStrategy() instanceof NetworkTopologyStrategy) return filterForEachQuorum(keyspace, liveEndpoints, readRepair); /* * Endpoints are expected to be restricted to live replicas, sorted by snitch preference. * For LOCAL_QUORUM, move local-DC replicas in front first as we need them there whether * we do read repair (since the first replica gets the data read) or not (since we'll take * the blockFor first ones). */ if (isDCLocal) Collections.sort(liveEndpoints, DatabaseDescriptor.getLocalComparator()); switch (readRepair) { case NONE: return liveEndpoints.subList(0, Math.min(liveEndpoints.size(), blockFor(keyspace))); case GLOBAL: return liveEndpoints; case DC_LOCAL: List<InetAddress> local = new ArrayList<InetAddress>(); List<InetAddress> other = new ArrayList<InetAddress>(); for (InetAddress add : liveEndpoints) {
List<InetAddress> allReplicas = StorageProxy.getLiveSortedEndpoints(keyspace, command.key); ReadRepairDecision repairDecision = Schema.instance.getCFMetaData(command.ksName, command.cfName).newReadRepairDecision(); List<InetAddress> targetReplicas = consistencyLevel.filterForQuery(keyspace, allReplicas, repairDecision);
? ReadRepairDecision.NONE : command.metadata().newReadRepairDecision(); List<InetAddress> targetReplicas = consistencyLevel.filterForQuery(keyspace, allReplicas, repairDecision);
? ReadRepairDecision.NONE : command.metadata().newReadRepairDecision(); List<InetAddress> targetReplicas = consistencyLevel.filterForQuery(keyspace, allReplicas, repairDecision);
? ReadRepairDecision.NONE : command.metadata().newReadRepairDecision(); List<InetAddress> targetReplicas = consistencyLevel.filterForQuery(keyspace, allReplicas, repairDecision);
: nextEndpoints; List<InetAddress> filteredEndpoints = nextFilteredEndpoints == null ? consistency_level.filterForQuery(keyspace, liveEndpoints) : nextFilteredEndpoints; ++i; nextFilteredEndpoints = consistency_level.filterForQuery(keyspace, nextEndpoints); break; List<InetAddress> filteredMerged = consistency_level.filterForQuery(keyspace, merged);
break; List<InetAddress> filteredMerged = consistency.filterForQuery(keyspace, merged);
break; List<InetAddress> filteredMerged = consistency.filterForQuery(keyspace, merged);
List<InetAddress> filteredMerged = consistency.filterForQuery(keyspace, merged);
break; List<InetAddress> filteredMerged = consistency.filterForQuery(keyspace, merged);