Example usage for org.apache.cassandra.repair.messages RepairOption PARALLELISM_KEY

List of usage examples for org.apache.cassandra.repair.messages RepairOption PARALLELISM_KEY

Introduction

In this page you can find the example usage for org.apache.cassandra.repair.messages RepairOption PARALLELISM_KEY.

Prototype

String PARALLELISM_KEY

To view the source code for org.apache.cassandra.repair.messages RepairOption PARALLELISM_KEY.

Click Source Link

Usage

From source file:com.mesosphere.dcos.cassandra.executor.tasks.Repair.java

License:Apache License

private void repairKeyspace(String keyspace, List<String> columnFamilies) throws Exception {
    LOGGER.info("Starting repair : keySpace = {}, columnFamilies = {}", keyspace, columnFamilies);

    Map<String, String> options = new HashMap<>();
    options.put(RepairOption.PRIMARY_RANGE_KEY, "true");
    options.put(RepairOption.COLUMNFAMILIES_KEY, String.join(",", columnFamilies));
    options.put(RepairOption.PARALLELISM_KEY, RepairParallelism.SEQUENTIAL.getName());
    options.put(RepairOption.INCREMENTAL_KEY, "true");

    String result = daemon.repair(keyspace, options);

    LOGGER.info("Repair output = {}", result);
    LOGGER.info("Completed repair : keySpace = {}, columnFamilies = {}", keyspace, columnFamilies);

    sendStatus(driver, Protos.TaskState.TASK_RUNNING,
            String.format("Completed repair : keySpace = %s, columnFamilies = %s", keyspace, columnFamilies));
}

From source file:io.cassandrareaper.jmx.JmxProxyImpl.java

License:Apache License

private int triggerRepairPost2dot2(boolean fullRepair, RepairParallelism repairParallelism, String keyspace,
        Collection<String> columnFamilies, BigInteger beginToken, BigInteger endToken, String cassandraVersion,
        Collection<String> datacenters, RepairStatusHandler repairStatusHandler,
        List<RingRange> associatedTokens, int repairThreadCount) {

    Map<String, String> options = new HashMap<>();

    options.put(RepairOption.PARALLELISM_KEY, repairParallelism.getName());
    options.put(RepairOption.INCREMENTAL_KEY, Boolean.toString(!fullRepair));
    options.put(RepairOption.JOB_THREADS_KEY, Integer.toString(repairThreadCount == 0 ? 1 : repairThreadCount));
    options.put(RepairOption.TRACE_KEY, Boolean.toString(Boolean.FALSE));
    options.put(RepairOption.COLUMNFAMILIES_KEY, StringUtils.join(columnFamilies, ","));
    // options.put(RepairOption.PULL_REPAIR_KEY, Boolean.FALSE);
    if (fullRepair) {
        options.put(RepairOption.RANGES_KEY, StringUtils.join(associatedTokens.stream()
                .map(token -> token.getStart() + ":" + token.getEnd()).collect(Collectors.toList()), ","));
    }//  w w  w  . j  ava2  s .c o m

    LOG.info("Triggering repair for ranges {}", options.get(RepairOption.RANGES_KEY));

    options.put(RepairOption.DATACENTERS_KEY, StringUtils.join(datacenters, ","));
    // options.put(RepairOption.HOSTS_KEY, StringUtils.join(specificHosts, ","));
    int commandId = ((StorageServiceMBean) ssProxy).repairAsync(keyspace, options);
    repairStatusHandlers.putIfAbsent(commandId, repairStatusHandler);

    return commandId;
}