Example usage for org.apache.cassandra.repair RepairParallelism DATACENTER_AWARE

List of usage examples for org.apache.cassandra.repair RepairParallelism DATACENTER_AWARE

Introduction

In this page you can find the example usage for org.apache.cassandra.repair RepairParallelism DATACENTER_AWARE.

Prototype

RepairParallelism DATACENTER_AWARE

To view the source code for org.apache.cassandra.repair RepairParallelism DATACENTER_AWARE.

Click Source Link

Document

One node per data center at a time

Usage

From source file:io.cassandrareaper.service.SegmentRunnerTest.java

License:Apache License

@Test
public void getNodeMetricsInLocalDCAvailabilityForLocalDCNodeTest() throws Exception {
    final AppContext context = new AppContext();
    context.storage = Mockito.mock(CassandraStorage.class);

    JmxProxy proxy = mock(JmxProxy.class);
    when(proxy.getClusterName()).thenReturn("test");
    when(proxy.getPendingCompactions()).thenReturn(3);
    when(proxy.isRepairRunning()).thenReturn(true);

    JmxConnectionFactory jmxConnectionFactory = mock(JmxConnectionFactory.class);
    when(jmxConnectionFactory.connect(any(), anyInt())).thenReturn(proxy);
    context.jmxConnectionFactory = jmxConnectionFactory;

    context.config = new ReaperApplicationConfiguration();
    context.config.setDatacenterAvailability(DatacenterAvailability.LOCAL);

    SegmentRunner segmentRunner = new SegmentRunner(context, UUID.randomUUID(), Collections.emptyList(), 1000,
            1.1, RepairParallelism.DATACENTER_AWARE, "test", mock(RepairUnit.class), mock(RepairRunner.class));
    Pair<String, Optional<NodeMetrics>> result = segmentRunner.getNodeMetrics("node-some", "dc1", "dc1").call();
    assertTrue(result.getRight().isPresent());
    NodeMetrics metrics = result.getRight().get();
    assertEquals("test", metrics.getCluster());
    assertEquals(3, metrics.getPendingCompactions());
    assertTrue(metrics.hasRepairRunning());
}

From source file:io.cassandrareaper.service.TestRepairConfiguration.java

License:Apache License

public static ReaperApplicationConfigurationBuilder defaultConfigBuilder() {
    return ReaperApplicationConfigurationBuilder.aReaperApplicationConfiguration().withEnableCrossOrigin(true)
            .withHangingRepairTimeoutMins(30).withRepairIntensity(0.9)
            .withRepairParallelism(RepairParallelism.DATACENTER_AWARE).withRepairRunThreadCount(15)
            .withScheduleDaysBetween(1).withSegmentCount(200).withStorageType("memory")
            .withAutoScheduling(defaultAutoSchedulingConfigBuilder().build());
}