本文整理汇总了Java中org.apache.cassandra.repair.RepairParallelism.DATACENTER_AWARE属性的典型用法代码示例。如果您正苦于以下问题:Java RepairParallelism.DATACENTER_AWARE属性的具体用法?Java RepairParallelism.DATACENTER_AWARE怎么用?Java RepairParallelism.DATACENTER_AWARE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.cassandra.repair.RepairParallelism
的用法示例。
在下文中一共展示了RepairParallelism.DATACENTER_AWARE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: aRepairSchedule
private RepairSchedule.Builder aRepairSchedule(Cluster cluster, String keyspace, DateTime creationTime) {
RepairUnit repairUnit = context.storage.addRepairUnit(aRepair(cluster, keyspace));
return new RepairSchedule.Builder(
repairUnit.getId(),
RepairSchedule.State.ACTIVE,
1,
DateTime.now(),
ImmutableList.of(),
10,
RepairParallelism.DATACENTER_AWARE,
0.9,
creationTime,
0);
}
示例2: execute
@Override
public void execute(NodeProbe probe)
{
List<String> keyspaces = parseOptionalKeyspace(args, probe);
String[] cfnames = parseOptionalColumnFamilies(args);
if (primaryRange && (!specificDataCenters.isEmpty() || !specificHosts.isEmpty()))
throw new RuntimeException("Primary range repair should be performed on all nodes in the cluster.");
for (String keyspace : keyspaces)
{
try
{
RepairParallelism parallelismDegree = RepairParallelism.SEQUENTIAL;
if (parallel)
parallelismDegree = RepairParallelism.PARALLEL;
else if (dcParallel)
parallelismDegree = RepairParallelism.DATACENTER_AWARE;
Collection<String> dataCenters = null;
Collection<String> hosts = null;
if (!specificDataCenters.isEmpty())
dataCenters = newArrayList(specificDataCenters);
else if (localDC)
dataCenters = newArrayList(probe.getDataCenter());
else if(!specificHosts.isEmpty())
hosts = newArrayList(specificHosts);
if (!startToken.isEmpty() || !endToken.isEmpty())
probe.forceRepairRangeAsync(System.out, keyspace, parallelismDegree, dataCenters,hosts, startToken, endToken, !incrementalRepair);
else
probe.forceRepairAsync(System.out, keyspace, parallelismDegree, dataCenters, hosts, primaryRange, !incrementalRepair, cfnames);
} catch (Exception e)
{
throw new RuntimeException("Error occurred during repair", e);
}
}
}
示例3: execute
@Override
public void execute(NodeProbe probe)
{
List<String> keyspaces = parseOptionalKeyspace(args, probe, KeyspaceSet.NON_LOCAL_STRATEGY);
String[] cfnames = parseOptionalTables(args);
if (primaryRange && (!specificDataCenters.isEmpty() || !specificHosts.isEmpty()))
throw new RuntimeException("Primary range repair should be performed on all nodes in the cluster.");
for (String keyspace : keyspaces)
{
// avoid repairing system_distributed by default (CASSANDRA-9621)
if ((args == null || args.isEmpty()) && ONLY_EXPLICITLY_REPAIRED.contains(keyspace))
continue;
Map<String, String> options = new HashMap<>();
RepairParallelism parallelismDegree = RepairParallelism.PARALLEL;
if (sequential)
parallelismDegree = RepairParallelism.SEQUENTIAL;
else if (dcParallel)
parallelismDegree = RepairParallelism.DATACENTER_AWARE;
options.put(RepairOption.PARALLELISM_KEY, parallelismDegree.getName());
options.put(RepairOption.PRIMARY_RANGE_KEY, Boolean.toString(primaryRange));
options.put(RepairOption.INCREMENTAL_KEY,
// Scylla does not support incremental repair, so its always full.
//Boolean.toString(!fullRepair)
"false"
);
options.put(RepairOption.JOB_THREADS_KEY, Integer.toString(numJobThreads));
options.put(RepairOption.TRACE_KEY, Boolean.toString(trace));
options.put(RepairOption.COLUMNFAMILIES_KEY, StringUtils.join(cfnames, ","));
if (!startToken.isEmpty() || !endToken.isEmpty())
{
options.put(RepairOption.RANGES_KEY, startToken + ":" + endToken);
}
if (localDC)
{
options.put(RepairOption.DATACENTERS_KEY, StringUtils.join(newArrayList(probe.getDataCenter()), ","));
}
else
{
options.put(RepairOption.DATACENTERS_KEY, StringUtils.join(specificDataCenters, ","));
}
options.put(RepairOption.HOSTS_KEY, StringUtils.join(specificHosts, ","));
try
{
probe.repairAsync(System.out, keyspace, options);
} catch (Exception e)
{
throw new RuntimeException("Error occurred during repair", e);
}
}
}