@Override protected int totalBlockFor() { // during bootstrap, include pending endpoints (only local here) in the count // or we may fail the consistency level guarantees (see #833, #8058) return consistencyLevel.blockFor(keyspace) + consistencyLevel.countLocalEndpoints(pendingEndpoints); }
@Override protected int totalBlockFor() { // during bootstrap, include pending endpoints (only local here) in the count // or we may fail the consistency level guarantees (see #833, #8058) return consistencyLevel.blockFor(keyspace) + consistencyLevel.countLocalEndpoints(pendingEndpoints); }
@Override protected int totalBlockFor() { // during bootstrap, include pending endpoints (only local here) in the count // or we may fail the consistency level guarantees (see #833, #8058) return consistencyLevel.blockFor(keyspace) + consistencyLevel.countLocalEndpoints(pendingEndpoints); }
@Override protected int totalBlockFor() { // during bootstrap, include pending endpoints (only local here) in the count // or we may fail the consistency level guarantees (see #833, #8058) return consistencyLevel.blockFor(keyspace) + consistencyLevel.countLocalEndpoints(pendingEndpoints); } }
public boolean isSufficientLiveNodes(Keyspace keyspace, Iterable<InetAddress> liveEndpoints) { switch (this) { case ANY: // local hint is acceptable, and local node is always live return true; case LOCAL_ONE: return countLocalEndpoints(liveEndpoints) >= 1; case LOCAL_QUORUM: return countLocalEndpoints(liveEndpoints) >= blockFor(keyspace); case EACH_QUORUM: if (keyspace.getReplicationStrategy() instanceof NetworkTopologyStrategy) { for (Map.Entry<String, Integer> entry : countPerDCEndpoints(keyspace, liveEndpoints).entrySet()) { if (entry.getValue() < localQuorumFor(keyspace, entry.getKey())) return false; } return true; } // Fallthough on purpose for SimpleStrategy default: return Iterables.size(liveEndpoints) >= blockFor(keyspace); } }
public boolean isSufficientLiveNodes(Keyspace keyspace, Iterable<InetAddress> liveEndpoints) { switch (this) { case ANY: // local hint is acceptable, and local node is always live return true; case LOCAL_ONE: return countLocalEndpoints(liveEndpoints) >= 1; case LOCAL_QUORUM: return countLocalEndpoints(liveEndpoints) >= blockFor(keyspace); case EACH_QUORUM: if (keyspace.getReplicationStrategy() instanceof NetworkTopologyStrategy) { for (Map.Entry<String, Integer> entry : countPerDCEndpoints(keyspace, liveEndpoints).entrySet()) { if (entry.getValue() < localQuorumFor(keyspace, entry.getKey())) return false; } return true; } // Fallthough on purpose for SimpleStrategy default: return Iterables.size(liveEndpoints) >= blockFor(keyspace); } }
public boolean isSufficientLiveNodes(Keyspace keyspace, Iterable<InetAddress> liveEndpoints) { switch (this) { case ANY: // local hint is acceptable, and local node is always live return true; case LOCAL_ONE: return countLocalEndpoints(liveEndpoints) >= 1; case LOCAL_QUORUM: return countLocalEndpoints(liveEndpoints) >= blockFor(keyspace); case EACH_QUORUM: if (keyspace.getReplicationStrategy() instanceof NetworkTopologyStrategy) { for (Map.Entry<String, Integer> entry : countPerDCEndpoints(keyspace, liveEndpoints).entrySet()) { if (entry.getValue() < localQuorumFor(keyspace, entry.getKey())) return false; } return true; } // Fallthough on purpose for SimpleStrategy default: return Iterables.size(liveEndpoints) >= blockFor(keyspace); } }
public boolean isSufficientLiveNodes(Keyspace keyspace, Iterable<InetAddress> liveEndpoints) { switch (this) { case ANY: // local hint is acceptable, and local node is always live return true; case LOCAL_ONE: return countLocalEndpoints(liveEndpoints) >= 1; case LOCAL_QUORUM: return countLocalEndpoints(liveEndpoints) >= blockFor(keyspace); case EACH_QUORUM: if (keyspace.getReplicationStrategy() instanceof NetworkTopologyStrategy) { for (Map.Entry<String, Integer> entry : countPerDCEndpoints(keyspace, liveEndpoints).entrySet()) { if (entry.getValue() < localQuorumFor(keyspace, entry.getKey())) return false; } return true; } // Fallthough on purpose for SimpleStrategy default: return Iterables.size(liveEndpoints) >= blockFor(keyspace); } }
if (countLocalEndpoints(liveEndpoints) == 0) throw new UnavailableException(this, 1, 0); break; case LOCAL_QUORUM: int localLive = countLocalEndpoints(liveEndpoints); if (localLive < blockFor)
if (countLocalEndpoints(liveEndpoints) == 0) throw new UnavailableException(this, 1, 0); break; case LOCAL_QUORUM: int localLive = countLocalEndpoints(liveEndpoints); if (localLive < blockFor)
if (countLocalEndpoints(liveEndpoints) == 0) throw new UnavailableException(this, 1, 0); break; case LOCAL_QUORUM: int localLive = countLocalEndpoints(liveEndpoints); if (localLive < blockFor)
if (countLocalEndpoints(liveEndpoints) == 0) throw new UnavailableException(this, 1, 0); break; case LOCAL_QUORUM: int localLive = countLocalEndpoints(liveEndpoints); if (localLive < blockFor)