public static FunctionCheckedException<CassandraClient, List<TokenRange>, Exception> getDescribeRing( CassandraKeyValueServiceConfig config) { return client -> client.describe_ring(config.getKeyspaceOrThrow()); } }
static Set<String> sanityCheckDatacenters(CassandraClient client, CassandraKeyValueServiceConfig config) throws TException { createSimpleRfTestKeyspaceIfNotExists(client); Multimap<String, String> datacenterToRack = HashMultimap.create(); Set<String> hosts = Sets.newHashSet(); for (TokenRange tokenRange : client.describe_ring(CassandraConstants.SIMPLE_RF_TEST_KEYSPACE)) { for (EndpointDetails details : tokenRange.getEndpoint_details()) { datacenterToRack.put(details.datacenter, details.rack); hosts.add(details.host); } } if (clusterHasExactlyOneDatacenter(datacenterToRack) && config.replicationFactor() > 1) { checkNodeTopologyIsSet(config, datacenterToRack); checkMoreRacksThanRfOrFewerHostsThanRf(config, hosts, datacenterToRack); } return datacenterToRack.keySet(); }
private void setTopology(EndpointDetails... details) throws TException { when(client.describe_ring(CassandraConstants.SIMPLE_RF_TEST_KEYSPACE)) .thenReturn(ImmutableList.of(mockRangeWithDetails(details))); }
return; // don't care to check for ring consistency when we're not even fully initialized tokenRangesToHost.put(ImmutableSet.copyOf(client.describe_ring(config.getKeyspaceOrThrow())), host); } catch (Exception e) { log.warn("Failed to get ring info from host: {}",
public static FunctionCheckedException<CassandraClient, List<TokenRange>, Exception> getDescribeRing( CassandraKeyValueServiceConfig config) { return client -> client.describe_ring(config.getKeyspaceOrThrow()); } }
static Set<String> sanityCheckDatacenters(CassandraClient client, CassandraKeyValueServiceConfig config) throws TException { createSimpleRfTestKeyspaceIfNotExists(client); Multimap<String, String> datacenterToRack = HashMultimap.create(); Set<String> hosts = Sets.newHashSet(); for (TokenRange tokenRange : client.describe_ring(CassandraConstants.SIMPLE_RF_TEST_KEYSPACE)) { for (EndpointDetails details : tokenRange.getEndpoint_details()) { datacenterToRack.put(details.datacenter, details.rack); hosts.add(details.host); } } if (clusterHasExactlyOneDatacenter(datacenterToRack) && config.replicationFactor() > 1) { checkNodeTopologyIsSet(config, datacenterToRack); checkMoreRacksThanRfOrFewerHostsThanRf(config, hosts, datacenterToRack); } return datacenterToRack.keySet(); }
return; // don't care to check for ring consistency when we're not even fully initialized tokenRangesToHost.put(ImmutableSet.copyOf(client.describe_ring(config.getKeyspaceOrThrow())), host); } catch (Exception e) { log.warn("Failed to get ring info from host: {}",