当前位置: 首页>>代码示例>>Java>>正文


Java RepairParallelism类代码示例

本文整理汇总了Java中org.apache.cassandra.repair.RepairParallelism的典型用法代码示例。如果您正苦于以下问题:Java RepairParallelism类的具体用法?Java RepairParallelism怎么用?Java RepairParallelism使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RepairParallelism类属于org.apache.cassandra.repair包,在下文中一共展示了RepairParallelism类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: repairKeyspace

import org.apache.cassandra.repair.RepairParallelism; //导入依赖的package包/类
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));
}
 
开发者ID:mesosphere,项目名称:dcos-cassandra-service,代码行数:24,代码来源:Repair.java

示例2: map

import org.apache.cassandra.repair.RepairParallelism; //导入依赖的package包/类
@Override
public RepairRun map(int index, ResultSet rs, StatementContext ctx) throws SQLException {
  RepairRun.RunState runState = RepairRun.RunState.valueOf(rs.getString("state"));
  RepairParallelism repairParallelism = RepairParallelism.fromName(
      rs.getString("repair_parallelism").toLowerCase().replace("datacenter_aware", "dc_parallel"));

  RepairRun.Builder repairRunBuilder = new RepairRun.Builder(
      rs.getString("cluster_name"),
      UuidUtil.fromSequenceId(rs.getLong("repair_unit_id")),
      getDateTimeOrNull(rs, "creation_time"),
      rs.getFloat("intensity"),
      rs.getInt("segment_count"),
      repairParallelism);

  return repairRunBuilder
      .runState(runState)
      .owner(rs.getString("owner"))
      .cause(rs.getString("cause"))
      .startTime(getDateTimeOrNull(rs, "start_time"))
      .endTime(getDateTimeOrNull(rs, "end_time"))
      .pauseTime(getDateTimeOrNull(rs, "pause_time"))
      .lastEvent(rs.getString("last_event"))
      .build(UuidUtil.fromSequenceId(rs.getLong("id")));
}
 
开发者ID:thelastpickle,项目名称:cassandra-reaper,代码行数:25,代码来源:RepairRunMapper.java

示例3: createRepairScheduleFromRow

import org.apache.cassandra.repair.RepairParallelism; //导入依赖的package包/类
private RepairSchedule createRepairScheduleFromRow(Row repairScheduleRow) {
  return new RepairSchedule.Builder(
          repairScheduleRow.getUUID("repair_unit_id"),
          RepairSchedule.State.valueOf(repairScheduleRow.getString("state")),
          repairScheduleRow.getInt("days_between"),
          new DateTime(repairScheduleRow.getTimestamp("next_activation")),
          ImmutableList.copyOf(repairScheduleRow.getSet("run_history", UUID.class)),
          repairScheduleRow.getInt("segment_count"),
          RepairParallelism.fromName(repairScheduleRow.getString("repair_parallelism")),
          repairScheduleRow.getDouble("intensity"),
          new DateTime(repairScheduleRow.getTimestamp("creation_time")),
          repairScheduleRow.getInt("segment_count_per_node"))
      .owner(repairScheduleRow.getString("owner"))
      .pauseTime(new DateTime(repairScheduleRow.getTimestamp("pause_time")))
      .build(repairScheduleRow.getUUID("id"));
}
 
开发者ID:thelastpickle,项目名称:cassandra-reaper,代码行数:17,代码来源:CassandraStorage.java

示例4: buildRepairRunFromRow

import org.apache.cassandra.repair.RepairParallelism; //导入依赖的package包/类
private RepairRun buildRepairRunFromRow(Row repairRunResult, UUID id) {
  LOG.trace("buildRepairRunFromRow {} / {}", id, repairRunResult);
  return new RepairRun.Builder(
      repairRunResult.getString("cluster_name"),
      repairRunResult.getUUID("repair_unit_id"),
      new DateTime(repairRunResult.getTimestamp("creation_time")),
      repairRunResult.getDouble("intensity"),
      repairRunResult.getInt("segment_count"),
      RepairParallelism.fromName(repairRunResult.getString("repair_parallelism")))
      .cause(repairRunResult.getString("cause"))
      .owner(repairRunResult.getString("owner"))
      .endTime(new DateTime(repairRunResult.getTimestamp("end_time")))
      .lastEvent(repairRunResult.getString("last_event"))
      .pauseTime(new DateTime(repairRunResult.getTimestamp("pause_time")))
      .runState(RunState.valueOf(repairRunResult.getString("state")))
      .startTime(new DateTime(repairRunResult.getTimestamp("start_time")))
      .build(id);
}
 
开发者ID:thelastpickle,项目名称:cassandra-reaper,代码行数:19,代码来源:CassandraStorage.java

示例5: Builder

import org.apache.cassandra.repair.RepairParallelism; //导入依赖的package包/类
public Builder(
    String clusterName,
    UUID repairUnitId,
    DateTime creationTime,
    double intensity,
    int segmentCount,
    RepairParallelism repairParallelism) {

  this.clusterName = clusterName;
  this.repairUnitId = repairUnitId;
  this.runState = RunState.NOT_STARTED;
  this.creationTime = creationTime;
  this.intensity = intensity;
  this.segmentCount = segmentCount;
  this.repairParallelism = repairParallelism;
}
 
开发者ID:thelastpickle,项目名称:cassandra-reaper,代码行数:17,代码来源:RepairRun.java

示例6: Builder

import org.apache.cassandra.repair.RepairParallelism; //导入依赖的package包/类
public Builder(
    UUID repairUnitId,
    State state,
    int daysBetween,
    DateTime nextActivation,
    ImmutableList<UUID> runHistory,
    int segmentCount,
    RepairParallelism repairParallelism,
    double intensity,
    DateTime creationTime,
    int segmentCountPerNode) {
  this.repairUnitId = repairUnitId;
  this.state = state;
  this.daysBetween = daysBetween;
  this.nextActivation = nextActivation;
  this.runHistory = runHistory;
  this.segmentCount = segmentCount;
  this.repairParallelism = repairParallelism;
  this.intensity = intensity;
  this.creationTime = creationTime;
  this.segmentCountPerNode = segmentCountPerNode;
}
 
开发者ID:thelastpickle,项目名称:cassandra-reaper,代码行数:23,代码来源:RepairSchedule.java

示例7: setUp

import org.apache.cassandra.repair.RepairParallelism; //导入依赖的package包/类
@Before
public void setUp() {
  //create a valid config
  DataSourceFactory dataSourceFactory = new DataSourceFactory();
  dataSourceFactory.setDriverClass("org.postgresql.Driver");
  dataSourceFactory.setUrl("jdbc:postgresql://db.example.com/db-prod");
  dataSourceFactory.setUser("user");
  CassandraFactory cassandraFactory = new CassandraFactory();
  cassandraFactory.setContactPoints(new String[]{"127.0.0.1"});
  config.setCassandraFactory(cassandraFactory);
  config.setPostgresDataSourceFactory(dataSourceFactory);
  config.setHangingRepairTimeoutMins(1);
  config.setRepairParallelism(RepairParallelism.DATACENTER_AWARE);
  config.setRepairRunThreadCount(1);
  config.setSegmentCount(1);
  config.setScheduleDaysBetween(7);
  config.setStorageType("foo");
  config.setIncrementalRepair(false);
}
 
开发者ID:thelastpickle,项目名称:cassandra-reaper,代码行数:20,代码来源:ReaperApplicationConfigurationTest.java

示例8: forceRepairAsync

import org.apache.cassandra.repair.RepairParallelism; //导入依赖的package包/类
public int forceRepairAsync(String keyspace, int parallelismDegree, Collection<String> dataCenters, Collection<String> hosts, boolean primaryRange, boolean fullRepair, String... columnFamilies)
{
    if (parallelismDegree < 0 || parallelismDegree > RepairParallelism.values().length - 1)
    {
        throw new IllegalArgumentException("Invalid parallelism degree specified: " + parallelismDegree);
    }
    Collection<Range<Token>> ranges;
    if (primaryRange)
    {
        // when repairing only primary range, neither dataCenters nor hosts can be set
        if (dataCenters == null && hosts == null)
            ranges = getPrimaryRanges(keyspace);
        // except dataCenters only contain local DC (i.e. -local)
        else if (dataCenters != null && dataCenters.size() == 1 && dataCenters.contains(DatabaseDescriptor.getLocalDataCenter()))
            ranges = getPrimaryRangesWithinDC(keyspace);
        else
            throw new IllegalArgumentException("You need to run primary range repair on all nodes in the cluster.");
    }
    else
    {
         ranges = getLocalRanges(keyspace);
    }

    return forceRepairAsync(keyspace, RepairParallelism.values()[parallelismDegree], dataCenters, hosts, ranges, fullRepair, columnFamilies);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:26,代码来源:StorageService.java

示例9: RepairOption

import org.apache.cassandra.repair.RepairParallelism; //导入依赖的package包/类
public RepairOption(RepairParallelism parallelism, boolean primaryRange, boolean incremental, boolean trace, int jobThreads, Collection<Range<Token>> ranges, boolean isSubrangeRepair)
{
    if (FBUtilities.isWindows() &&
        (DatabaseDescriptor.getDiskAccessMode() != Config.DiskAccessMode.standard || DatabaseDescriptor.getIndexAccessMode() != Config.DiskAccessMode.standard) &&
        parallelism == RepairParallelism.SEQUENTIAL)
    {
        logger.warn("Sequential repair disabled when memory-mapped I/O is configured on Windows. Reverting to parallel.");
        this.parallelism = RepairParallelism.PARALLEL;
    }
    else
        this.parallelism = parallelism;

    this.primaryRange = primaryRange;
    this.incremental = incremental;
    this.trace = trace;
    this.jobThreads = jobThreads;
    this.ranges.addAll(ranges);
    this.isSubrangeRepair = isSubrangeRepair;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:20,代码来源:RepairOption.java

示例10: getOptions

import org.apache.cassandra.repair.RepairParallelism; //导入依赖的package包/类
Map<String,String> getOptions() {
    Map<String, String> result = new HashMap<>();
    result.put(RepairOption.PARALLELISM_KEY, String.valueOf(RepairParallelism.SEQUENTIAL));
    result.put(RepairOption.HOSTS_KEY, endpoint);
    if(!table.equals("") && !table.equals("*")) {
        result.put(RepairOption.COLUMNFAMILIES_KEY, table);
    }
    result.put(RepairOption.RANGES_KEY, String.format("%s:%s", start, end));
    return result;
}
 
开发者ID:skbkontur,项目名称:cajrr,代码行数:11,代码来源:Repair.java

示例11: checkRepairParallelismString

import org.apache.cassandra.repair.RepairParallelism; //导入依赖的package包/类
private static void checkRepairParallelismString(String repairParallelism) throws ReaperException {
  try {
    RepairParallelism.valueOf(repairParallelism.toUpperCase());
  } catch (IllegalArgumentException ex) {
    throw new ReaperException(
        "invalid repair parallelism given \""
        + repairParallelism
        + "\", must be one of: "
        + Arrays.toString(RepairParallelism.values()),
        ex);
  }
}
 
开发者ID:thelastpickle,项目名称:cassandra-reaper,代码行数:13,代码来源:RepairRunResource.java

示例12: RepairScheduleStatus

import org.apache.cassandra.repair.RepairParallelism; //导入依赖的package包/类
public RepairScheduleStatus(
    UUID id,
    String owner,
    String clusterName,
    String keyspaceName,
    Collection<String> columnFamilies,
    RepairSchedule.State state,
    DateTime creationTime,
    DateTime nextActivation,
    DateTime pauseTime,
    double intensity,
    boolean incrementalRepair,
    int segmentCount,
    RepairParallelism repairParallelism,
    int daysBetween,
    Collection<String> nodes,
    Collection<String> datacenters,
    Collection<String> blacklistedTables,
    int segmentCountPerNode) {

  this.id = id;
  this.owner = owner;
  this.clusterName = clusterName;
  this.keyspaceName = keyspaceName;
  this.columnFamilies = columnFamilies;
  this.state = state;
  this.creationTime = creationTime;
  this.nextActivation = nextActivation;
  this.pauseTime = pauseTime;
  this.intensity = RepairRunStatus.roundDoubleNicely(intensity);
  this.incrementalRepair = incrementalRepair;
  this.segmentCount = segmentCount;
  this.repairParallelism = repairParallelism;
  this.daysBetween = daysBetween;
  this.nodes = nodes;
  this.datacenters = datacenters;
  this.blacklistedTables = blacklistedTables;
  this.segmentCountPerNode = segmentCountPerNode;
}
 
开发者ID:thelastpickle,项目名称:cassandra-reaper,代码行数:40,代码来源:RepairScheduleStatus.java

示例13: triggerRepair

import org.apache.cassandra.repair.RepairParallelism; //导入依赖的package包/类
/**
 * Triggers a repair of range (beginToken, endToken] for given keyspace and column family. The repair is triggered by
 * {@link org.apache.cassandra.service.StorageServiceMBean#forceRepairRangeAsync} For time being, we don't allow local
 * nor snapshot repairs.
 *
 * @return Repair command number, or 0 if nothing to repair
 */
int triggerRepair(
    BigInteger beginToken,
    BigInteger endToken,
    String keyspace,
    RepairParallelism repairParallelism,
    Collection<String> columnFamilies,
    boolean fullRepair,
    Collection<String> datacenters) throws ReaperException;
 
开发者ID:thelastpickle,项目名称:cassandra-reaper,代码行数:16,代码来源:JmxProxy.java

示例14: triggerRepairPost2dot2

import org.apache.cassandra.repair.RepairParallelism; //导入依赖的package包/类
private int triggerRepairPost2dot2(
    boolean fullRepair,
    RepairParallelism repairParallelism,
    String keyspace,
    Collection<String> columnFamilies,
    BigInteger beginToken,
    BigInteger endToken,
    String cassandraVersion,
    Collection<String> datacenters) {

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

  options.put(RepairOption.PARALLELISM_KEY, repairParallelism.getName());
  // options.put(RepairOption.PRIMARY_RANGE_KEY, Boolean.toString(primaryRange));
  options.put(RepairOption.INCREMENTAL_KEY, Boolean.toString(!fullRepair));
  options.put(RepairOption.JOB_THREADS_KEY, Integer.toString(1));
  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, beginToken.toString() + ":" + endToken.toString());
  }

  options.put(RepairOption.DATACENTERS_KEY, StringUtils.join(datacenters, ","));
  // options.put(RepairOption.HOSTS_KEY, StringUtils.join(specificHosts, ","));

  return ((StorageServiceMBean) ssProxy).repairAsync(keyspace, options);
}
 
开发者ID:thelastpickle,项目名称:cassandra-reaper,代码行数:29,代码来源:JmxProxyImpl.java

示例15: triggerRepairPre2dot1

import org.apache.cassandra.repair.RepairParallelism; //导入依赖的package包/类
private int triggerRepairPre2dot1(
    RepairParallelism repairParallelism,
    String keyspace,
    Collection<String> columnFamilies,
    BigInteger beginToken,
    BigInteger endToken,
    Collection<String> datacenters) {

  // Cassandra 1.2 and 2.0 compatibility
  if (repairParallelism.equals(RepairParallelism.DATACENTER_AWARE)) {
    return ((StorageServiceMBean20) ssProxy)
        .forceRepairRangeAsync(
            beginToken.toString(),
            endToken.toString(),
            keyspace,
            repairParallelism.ordinal(),
            datacenters,
            null,
            columnFamilies.toArray(new String[columnFamilies.size()]));
  }
  boolean snapshotRepair = repairParallelism.equals(RepairParallelism.SEQUENTIAL);
  return ((StorageServiceMBean20) ssProxy)
      .forceRepairRangeAsync(
          beginToken.toString(),
          endToken.toString(),
          keyspace,
          snapshotRepair,
          false,
          columnFamilies.toArray(new String[columnFamilies.size()]));
}
 
开发者ID:thelastpickle,项目名称:cassandra-reaper,代码行数:31,代码来源:JmxProxyImpl.java


注:本文中的org.apache.cassandra.repair.RepairParallelism类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。