Search in sources :

Example 1 with SimpleStrategy

use of org.apache.cassandra.locator.SimpleStrategy in project cassandra by apache.

the class MoveTransientTest method invokeCalculateRangesToFetchWithPreferredEndpoints.

private void invokeCalculateRangesToFetchWithPreferredEndpoints(RangesAtEndpoint toFetch, Pair<TokenMetadata, TokenMetadata> tmds, EndpointsByReplica expectedResult) {
    DatabaseDescriptor.setTransientReplicationEnabledUnsafe(true);
    EndpointsByReplica result = RangeStreamer.calculateRangesToFetchWithPreferredEndpoints((address, replicas) -> replicas.sorted((a, b) -> b.endpoint().compareTo(a.endpoint())), simpleStrategy(tmds.left), toFetch, true, tmds.left, tmds.right, "TestKeyspace", sourceFilters);
    logger.info("Ranges to fetch with preferred endpoints");
    logger.info(result.toString());
    assertMultimapEqualsIgnoreOrder(expectedResult, result);
}
Also used : StorageServiceTest.assertMultimapEqualsIgnoreOrder(org.apache.cassandra.service.StorageServiceTest.assertMultimapEqualsIgnoreOrder) InetAddressAndPort(org.apache.cassandra.locator.InetAddressAndPort) Arrays(java.util.Arrays) Iterables(com.google.common.collect.Iterables) BeforeClass(org.junit.BeforeClass) LoggerFactory(org.slf4j.LoggerFactory) Range(org.apache.cassandra.dht.Range) ArrayList(java.util.ArrayList) RandomPartitioner(org.apache.cassandra.dht.RandomPartitioner) IEndpointSnitch(org.apache.cassandra.locator.IEndpointSnitch) Token(org.apache.cassandra.dht.Token) AbstractEndpointSnitch(org.apache.cassandra.locator.AbstractEndpointSnitch) Replica.fullReplica(org.apache.cassandra.locator.Replica.fullReplica) TokenMetadata(org.apache.cassandra.locator.TokenMetadata) Pair(org.apache.cassandra.utils.Pair) After(org.junit.After) SimpleStrategy(org.apache.cassandra.locator.SimpleStrategy) RangeStreamer(org.apache.cassandra.dht.RangeStreamer) DatabaseDescriptor(org.apache.cassandra.config.DatabaseDescriptor) Logger(org.slf4j.Logger) Collection(java.util.Collection) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) RangesByEndpoint(org.apache.cassandra.locator.RangesByEndpoint) RangesAtEndpoint(org.apache.cassandra.locator.RangesAtEndpoint) Replica(org.apache.cassandra.locator.Replica) Replica.transientReplica(org.apache.cassandra.locator.Replica.transientReplica) List(java.util.List) AbstractReplicationStrategy(org.apache.cassandra.locator.AbstractReplicationStrategy) EndpointsByReplica(org.apache.cassandra.locator.EndpointsByReplica) Assert.assertEquals(org.junit.Assert.assertEquals) EndpointsByReplica(org.apache.cassandra.locator.EndpointsByReplica)

Aggregations

Iterables (com.google.common.collect.Iterables)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 List (java.util.List)1 DatabaseDescriptor (org.apache.cassandra.config.DatabaseDescriptor)1 RandomPartitioner (org.apache.cassandra.dht.RandomPartitioner)1 Range (org.apache.cassandra.dht.Range)1 RangeStreamer (org.apache.cassandra.dht.RangeStreamer)1 Token (org.apache.cassandra.dht.Token)1 AbstractEndpointSnitch (org.apache.cassandra.locator.AbstractEndpointSnitch)1 AbstractReplicationStrategy (org.apache.cassandra.locator.AbstractReplicationStrategy)1 EndpointsByReplica (org.apache.cassandra.locator.EndpointsByReplica)1 IEndpointSnitch (org.apache.cassandra.locator.IEndpointSnitch)1 InetAddressAndPort (org.apache.cassandra.locator.InetAddressAndPort)1 RangesAtEndpoint (org.apache.cassandra.locator.RangesAtEndpoint)1 RangesByEndpoint (org.apache.cassandra.locator.RangesByEndpoint)1 Replica (org.apache.cassandra.locator.Replica)1 Replica.fullReplica (org.apache.cassandra.locator.Replica.fullReplica)1 Replica.transientReplica (org.apache.cassandra.locator.Replica.transientReplica)1