Java 类org.apache.hadoop.hbase.chaos.actions.Action 实例源码

项目:ditb    文件:TwoConcurrentActionPolicy.java   
@Override
protected void runOneIteration() {
  Action actionOne = PolicyBasedChaosMonkey.selectRandomItem(actionsOne);
  Action actionTwo = PolicyBasedChaosMonkey.selectRandomItem(actionsTwo);

  Future fOne = executor.submit(new ActionRunner(actionOne));
  Future fTwo = executor.submit(new ActionRunner(actionTwo));

  try {
    fOne.get();
    fTwo.get();
  } catch (InterruptedException e) {
    LOG.warn("Exception occurred during performing action: "
        + StringUtils.stringifyException(e));
  } catch (ExecutionException ex) {
    LOG.warn("Exception occurred during performing action: "
        + StringUtils.stringifyException(ex));
  }
}
项目:ditb    文件:MasterKillingMonkeyFactory.java   
@Override
public ChaosMonkey build() {
  loadProperties();

  // Destructive actions to mess things around.
  Action[] actions1 = new Action[] {
      new RestartActiveMasterAction(restartActiveMasterSleepTime),
  };

  // Action to log more info for debugging
  Action[] actions2 = new Action[] {
      new DumpClusterStatusAction()
  };

  return new PolicyBasedChaosMonkey(util,
      new PeriodicRandomActionPolicy(action1Period, actions1),
      new PeriodicRandomActionPolicy(action2Period, actions2));
}
项目:ditb    文件:ServerKillingMonkeyFactory.java   
@Override
public ChaosMonkey build() {

  // Destructive actions to mess things around. Cannot run batch restart
  Action[] actions1 = new Action[] {
      new RestartRandomRsExceptMetaAction(60000),
      new RestartActiveMasterAction(5000),
      new RollingBatchRestartRsExceptMetaAction(5000, 1.0f, 2), //only allow 2 servers to be dead
      new ForceBalancerAction()
  };

  // Action to log more info for debugging
  Action[] actions2 = new Action[] {
      new DumpClusterStatusAction()
  };

  return new PolicyBasedChaosMonkey(util,
    new CompositeSequentialPolicy(
        new DoActionsOncePolicy(60 * 1000, actions1),
        new PeriodicRandomActionPolicy(60 * 1000, actions1)),
    new PeriodicRandomActionPolicy(60 * 1000, actions2));
}
项目:ditb    文件:ServerAndDependenciesKillingMonkeyFactory.java   
@Override
public ChaosMonkey build() {

  // Destructive actions to mess things around. Cannot run batch restart.
  Action[] actions1 = new Action[]{
    new RestartRandomRsExceptMetaAction(60000),
    new RestartActiveMasterAction(5000),
    new RollingBatchRestartRsExceptMetaAction(5000, 1.0f, 2), // only allow 2 servers to be dead.
    new ForceBalancerAction(),
    new RestartRandomDataNodeAction(60000),
    new RestartRandomZKNodeAction(60000)
  };

  // Action to log more info for debugging
  Action[] actions2 = new Action[]{
    new DumpClusterStatusAction()
  };

  return new PolicyBasedChaosMonkey(util,
    new CompositeSequentialPolicy(
      new DoActionsOncePolicy(60 * 1000, actions1),
      new PeriodicRandomActionPolicy(60 * 1000, actions1)),
    new PeriodicRandomActionPolicy(60 * 1000, actions2));
}
项目:HIndex    文件:IntegrationTestMTTR.java   
private static void setupActions() throws IOException {
  // Set up the action that will restart a region server holding a region from our table
  // because this table should only have one region we should be good.
  restartRSAction = new RestartRsHoldingTableAction(sleepTime, tableName.getNameAsString());

  // Set up the action that will kill the region holding meta.
  restartMetaAction = new RestartRsHoldingMetaAction(sleepTime);

  // Set up the action that will move the regions of our table.
  moveRegionAction = new MoveRegionsOfTableAction(sleepTime, tableName.getNameAsString());

  // Kill the master
  restartMasterAction = new RestartActiveMasterAction(1000);

  // Give the action the access to the cluster.
  Action.ActionContext actionContext = new Action.ActionContext(util);
  restartRSAction.init(actionContext);
  restartMetaAction.init(actionContext);
  moveRegionAction.init(actionContext);
  restartMasterAction.init(actionContext);
}
项目:hbase    文件:TwoConcurrentActionPolicy.java   
@Override
protected void runOneIteration() {
  Action actionOne = PolicyBasedChaosMonkey.selectRandomItem(actionsOne);
  Action actionTwo = PolicyBasedChaosMonkey.selectRandomItem(actionsTwo);

  Future fOne = executor.submit(new ActionRunner(actionOne));
  Future fTwo = executor.submit(new ActionRunner(actionTwo));

  try {
    fOne.get();
    fTwo.get();
  } catch (InterruptedException e) {
    LOG.warn("Exception occurred during performing action: "
        + StringUtils.stringifyException(e));
  } catch (ExecutionException ex) {
    LOG.warn("Exception occurred during performing action: "
        + StringUtils.stringifyException(ex));
  }
}
项目:hbase    文件:MasterKillingMonkeyFactory.java   
@Override
public ChaosMonkey build() {
  loadProperties();

  // Destructive actions to mess things around.
  Action[] actions1 = new Action[] {
      new RestartActiveMasterAction(restartActiveMasterSleepTime),
  };

  // Action to log more info for debugging
  Action[] actions2 = new Action[] {
      new DumpClusterStatusAction()
  };

  return new PolicyBasedChaosMonkey(util,
      new PeriodicRandomActionPolicy(action1Period, actions1),
      new PeriodicRandomActionPolicy(action2Period, actions2));
}
项目:hbase    文件:ServerKillingMonkeyFactory.java   
@Override
public ChaosMonkey build() {

  // Destructive actions to mess things around. Cannot run batch restart
  Action[] actions1 = new Action[] {
      new RestartRandomRsExceptMetaAction(60000),
      new RestartActiveMasterAction(5000),
      new RollingBatchRestartRsExceptMetaAction(5000, 1.0f, 2), //only allow 2 servers to be dead
      new ForceBalancerAction()
  };

  // Action to log more info for debugging
  Action[] actions2 = new Action[] {
      new DumpClusterStatusAction()
  };

  return new PolicyBasedChaosMonkey(util,
    new CompositeSequentialPolicy(
        new DoActionsOncePolicy(60 * 1000, actions1),
        new PeriodicRandomActionPolicy(60 * 1000, actions1)),
    new PeriodicRandomActionPolicy(60 * 1000, actions2));
}
项目:hbase    文件:ServerAndDependenciesKillingMonkeyFactory.java   
@Override
public ChaosMonkey build() {

  // Destructive actions to mess things around. Cannot run batch restart.
  Action[] actions1 = new Action[]{
    new RestartRandomRsExceptMetaAction(60000),
    new RestartActiveMasterAction(5000),
    new RollingBatchRestartRsExceptMetaAction(5000, 1.0f, 2), // only allow 2 servers to be dead.
    new ForceBalancerAction(),
    new RestartRandomDataNodeAction(60000),
    new RestartRandomZKNodeAction(60000)
  };

  // Action to log more info for debugging
  Action[] actions2 = new Action[]{
    new DumpClusterStatusAction()
  };

  return new PolicyBasedChaosMonkey(util,
    new CompositeSequentialPolicy(
      new DoActionsOncePolicy(60 * 1000, actions1),
      new PeriodicRandomActionPolicy(60 * 1000, actions1)),
    new PeriodicRandomActionPolicy(60 * 1000, actions2));
}
项目:PyroDB    文件:IntegrationTestMTTR.java   
private static void setupActions() throws IOException {
  // Set up the action that will restart a region server holding a region from our table
  // because this table should only have one region we should be good.
  restartRSAction = new RestartRsHoldingTableAction(sleepTime, tableName.getNameAsString());

  // Set up the action that will kill the region holding meta.
  restartMetaAction = new RestartRsHoldingMetaAction(sleepTime);

  // Set up the action that will move the regions of our table.
  moveRegionAction = new MoveRegionsOfTableAction(sleepTime, tableName.getNameAsString());

  // Kill the master
  restartMasterAction = new RestartActiveMasterAction(1000);

  // Give the action the access to the cluster.
  Action.ActionContext actionContext = new Action.ActionContext(util);
  restartRSAction.init(actionContext);
  restartMetaAction.init(actionContext);
  moveRegionAction.init(actionContext);
  restartMasterAction.init(actionContext);
}
项目:ditb    文件:IntegrationTestMTTR.java   
private static void setupActions() throws IOException {
  // allow a little more time for RS restart actions because RS start depends on having a master
  // to report to and the master is also being monkeyed.
  util.getConfiguration().setLong(Action.START_RS_TIMEOUT_KEY, 3 * 60 * 1000);

  // Set up the action that will restart a region server holding a region from our table
  // because this table should only have one region we should be good.
  restartRSAction = new RestartRsHoldingTableAction(sleepTime, tableName.getNameAsString());

  // Set up the action that will kill the region holding meta.
  restartMetaAction = new RestartRsHoldingMetaAction(sleepTime);

  // Set up the action that will move the regions of meta.
  moveMetaRegionsAction = new MoveRegionsOfTableAction(sleepTime,
      MonkeyConstants.DEFAULT_MOVE_REGIONS_MAX_TIME, TableName.META_TABLE_NAME);

  // Set up the action that will move the regions of our table.
  moveRegionAction = new MoveRegionsOfTableAction(sleepTime,
      MonkeyConstants.DEFAULT_MOVE_REGIONS_MAX_TIME, tableName);

  // Kill the master
  restartMasterAction = new RestartActiveMasterAction(1000);

  // Give the action the access to the cluster.
  Action.ActionContext actionContext = new Action.ActionContext(util);
  restartRSAction.init(actionContext);
  restartMetaAction.init(actionContext);
  moveMetaRegionsAction.init(actionContext);
  moveRegionAction.init(actionContext);
  restartMasterAction.init(actionContext);
}
项目:ditb    文件:TwoConcurrentActionPolicy.java   
public TwoConcurrentActionPolicy(long sleepTime, Action[] actionsOne, Action[] actionsTwo) {
  super(sleepTime);
  this.actionsOne = actionsOne;
  this.actionsTwo = actionsTwo;
  executor = Executors.newFixedThreadPool(2,
      new DaemonThreadFactory("TwoConcurrentAction-"));
}
项目:ditb    文件:DoActionsOncePolicy.java   
@Override
protected void runOneIteration() {
  if (actions.isEmpty()) {
    this.stop("done");
    return;
  }
  Action action = actions.remove(0);

  try {
    action.perform();
  } catch (Exception ex) {
    LOG.warn("Exception occured during performing action: "
        + StringUtils.stringifyException(ex));
  }
}
项目:ditb    文件:DoActionsOncePolicy.java   
@Override
public void init(PolicyContext context) throws Exception {
  super.init(context);
  for (Action action : actions) {
    action.init(this.context);
  }
}
项目:ditb    文件:PeriodicRandomActionPolicy.java   
public PeriodicRandomActionPolicy(long periodMs, Action... actions) {
  super(periodMs);
  this.actions = new ArrayList<Pair<Action, Integer>>(actions.length);
  for (Action action : actions) {
    this.actions.add(new Pair<Action, Integer>(action, 1));
  }
}
项目:ditb    文件:PeriodicRandomActionPolicy.java   
@Override
protected void runOneIteration() {
  Action action = PolicyBasedChaosMonkey.selectWeightedRandomItem(actions);
  try {
    action.perform();
  } catch (Exception ex) {
    LOG.warn("Exception occured during performing action: "
        + StringUtils.stringifyException(ex));
  }
}
项目:ditb    文件:PeriodicRandomActionPolicy.java   
@Override
public void init(PolicyContext context) throws Exception {
  super.init(context);
  for (Pair<Action, Integer> action : actions) {
    action.getFirst().init(this.context);
  }
}
项目:ditb    文件:NoKillMonkeyFactory.java   
@Override public ChaosMonkey build() {
  Action[] actions1 = new Action[] {
      new CompactTableAction(tableName, MonkeyConstants.DEFAULT_PERIODIC_ACTION1_PERIOD),
      new CompactRandomRegionOfTableAction(tableName,
          MonkeyConstants.DEFAULT_COMPACT_RANDOM_REGION_RATIO),
      new FlushTableAction(tableName),
      new FlushRandomRegionOfTableAction(tableName),
      new MoveRandomRegionOfTableAction(tableName)
  };

  Action[] actions2 = new Action[] {
      new SplitRandomRegionOfTableAction(tableName),
      new MergeRandomAdjacentRegionsOfTableAction(tableName),
      new SnapshotTableAction(tableName),
      new AddColumnAction(tableName),
      new RemoveColumnAction(tableName, columnFamilies),
      new ChangeEncodingAction(tableName),
      new ChangeCompressionAction(tableName),
      new ChangeBloomFilterAction(tableName),
      new ChangeVersionsAction(tableName)
  };

  Action[] actions3 = new Action[] {
      new MoveRegionsOfTableAction(MonkeyConstants.DEFAULT_MOVE_REGIONS_SLEEP_TIME,
          MonkeyConstants.DEFAULT_MOVE_REGIONS_MAX_TIME,
          tableName),
      new MoveRandomRegionOfTableAction(MonkeyConstants.DEFAULT_RESTART_ACTIVE_MASTER_SLEEP_TIME,
          tableName),
  };

  Action[] actions4 = new Action[] {
      new DumpClusterStatusAction()
  };

  return new PolicyBasedChaosMonkey(util,
      new TwoConcurrentActionPolicy(MonkeyConstants.DEFAULT_PERIODIC_ACTION1_PERIOD, actions1, actions2),
      new PeriodicRandomActionPolicy(MonkeyConstants.DEFAULT_PERIODIC_ACTION2_PERIOD,actions3),
      new PeriodicRandomActionPolicy(MonkeyConstants.DEFAULT_PERIODIC_ACTION4_PERIOD,actions4));
}
项目:HIndex    文件:DoActionsOncePolicy.java   
@Override
protected void runOneIteration() {
  if (actions.isEmpty()) {
    this.stop("done");
    return;
  }
  Action action = actions.remove(0);

  try {
    action.perform();
  } catch (Exception ex) {
    LOG.warn("Exception occured during performing action: "
        + StringUtils.stringifyException(ex));
  }
}
项目:HIndex    文件:DoActionsOncePolicy.java   
@Override
public void init(PolicyContext context) throws Exception {
  super.init(context);
  for (Action action : actions) {
    action.init(this.context);
  }
}
项目:HIndex    文件:PeriodicRandomActionPolicy.java   
public PeriodicRandomActionPolicy(long periodMs, Action... actions) {
  super(periodMs);
  this.actions = new ArrayList<Pair<Action, Integer>>(actions.length);
  for (Action action : actions) {
    this.actions.add(new Pair<Action, Integer>(action, 1));
  }
}
项目:HIndex    文件:PeriodicRandomActionPolicy.java   
@Override
protected void runOneIteration() {
  Action action = PolicyBasedChaosMonkey.selectWeightedRandomItem(actions);
  try {
    action.perform();
  } catch (Exception ex) {
    LOG.warn("Exception occured during performing action: "
        + StringUtils.stringifyException(ex));
  }
}
项目:HIndex    文件:PeriodicRandomActionPolicy.java   
@Override
public void init(PolicyContext context) throws Exception {
  super.init(context);
  for (Pair<Action, Integer> action : actions) {
    action.getFirst().init(this.context);
  }
}
项目:hbase    文件:IntegrationTestMTTR.java   
private static void setupActions() throws IOException {
  // allow a little more time for RS restart actions because RS start depends on having a master
  // to report to and the master is also being monkeyed.
  util.getConfiguration().setLong(Action.START_RS_TIMEOUT_KEY, 3 * 60 * 1000);

  // Set up the action that will restart a region server holding a region from our table
  // because this table should only have one region we should be good.
  restartRSAction = new RestartRsHoldingTableAction(sleepTime,
      util.getConnection().getRegionLocator(tableName));

  // Set up the action that will kill the region holding meta.
  restartMetaAction = new RestartRsHoldingMetaAction(sleepTime);

  // Set up the action that will move the regions of meta.
  moveMetaRegionsAction = new MoveRegionsOfTableAction(sleepTime,
      MonkeyConstants.DEFAULT_MOVE_REGIONS_MAX_TIME, TableName.META_TABLE_NAME);

  // Set up the action that will move the regions of our table.
  moveRegionAction = new MoveRegionsOfTableAction(sleepTime,
      MonkeyConstants.DEFAULT_MOVE_REGIONS_MAX_TIME, tableName);

  // Kill the master
  restartMasterAction = new RestartActiveMasterAction(1000);

  // Give the action the access to the cluster.
  Action.ActionContext actionContext = new Action.ActionContext(util);
  restartRSAction.init(actionContext);
  restartMetaAction.init(actionContext);
  moveMetaRegionsAction.init(actionContext);
  moveRegionAction.init(actionContext);
  restartMasterAction.init(actionContext);
}
项目:hbase    文件:TwoConcurrentActionPolicy.java   
public TwoConcurrentActionPolicy(long sleepTime, Action[] actionsOne, Action[] actionsTwo) {
  super(sleepTime);
  this.actionsOne = actionsOne;
  this.actionsTwo = actionsTwo;
  executor = Executors.newFixedThreadPool(2,
      new DaemonThreadFactory("TwoConcurrentAction-"));
}
项目:hbase    文件:DoActionsOncePolicy.java   
@Override
protected void runOneIteration() {
  if (actions.isEmpty()) {
    this.stop("done");
    return;
  }
  Action action = actions.remove(0);

  try {
    action.perform();
  } catch (Exception ex) {
    LOG.warn("Exception occurred during performing action: "
        + StringUtils.stringifyException(ex));
  }
}
项目:hbase    文件:DoActionsOncePolicy.java   
@Override
public void init(PolicyContext context) throws Exception {
  super.init(context);
  for (Action action : actions) {
    action.init(this.context);
  }
}
项目:hbase    文件:PeriodicRandomActionPolicy.java   
public PeriodicRandomActionPolicy(long periodMs, Action... actions) {
  super(periodMs);
  this.actions = new ArrayList<>(actions.length);
  for (Action action : actions) {
    this.actions.add(new Pair<>(action, 1));
  }
}
项目:hbase    文件:PeriodicRandomActionPolicy.java   
@Override
protected void runOneIteration() {
  Action action = PolicyBasedChaosMonkey.selectWeightedRandomItem(actions);
  try {
    action.perform();
  } catch (Exception ex) {
    LOG.warn("Exception occurred during performing action: "
        + StringUtils.stringifyException(ex));
  }
}
项目:hbase    文件:PeriodicRandomActionPolicy.java   
@Override
public void init(PolicyContext context) throws Exception {
  super.init(context);
  for (Pair<Action, Integer> action : actions) {
    action.getFirst().init(this.context);
  }
}
项目:hbase    文件:NoKillMonkeyFactory.java   
@Override public ChaosMonkey build() {
  Action[] actions1 = new Action[] {
      new CompactTableAction(tableName, MonkeyConstants.DEFAULT_PERIODIC_ACTION1_PERIOD),
      new CompactRandomRegionOfTableAction(tableName,
          MonkeyConstants.DEFAULT_COMPACT_RANDOM_REGION_RATIO),
      new FlushTableAction(tableName),
      new FlushRandomRegionOfTableAction(tableName),
      new MoveRandomRegionOfTableAction(tableName)
  };

  Action[] actions2 = new Action[] {
      new SplitRandomRegionOfTableAction(tableName),
      new MergeRandomAdjacentRegionsOfTableAction(tableName),
      new SnapshotTableAction(tableName),
      new AddColumnAction(tableName),
      new RemoveColumnAction(tableName, columnFamilies),
      new ChangeEncodingAction(tableName),
      new ChangeCompressionAction(tableName),
      new ChangeBloomFilterAction(tableName),
      new ChangeVersionsAction(tableName)
  };

  Action[] actions3 = new Action[] {
      new MoveRegionsOfTableAction(MonkeyConstants.DEFAULT_MOVE_REGIONS_SLEEP_TIME,
          MonkeyConstants.DEFAULT_MOVE_REGIONS_MAX_TIME,
          tableName),
      new MoveRandomRegionOfTableAction(MonkeyConstants.DEFAULT_RESTART_ACTIVE_MASTER_SLEEP_TIME,
          tableName),
  };

  Action[] actions4 = new Action[] {
      new DumpClusterStatusAction()
  };

  return new PolicyBasedChaosMonkey(util,
      new TwoConcurrentActionPolicy(MonkeyConstants.DEFAULT_PERIODIC_ACTION1_PERIOD, actions1, actions2),
      new PeriodicRandomActionPolicy(MonkeyConstants.DEFAULT_PERIODIC_ACTION2_PERIOD,actions3),
      new PeriodicRandomActionPolicy(MonkeyConstants.DEFAULT_PERIODIC_ACTION4_PERIOD,actions4));
}
项目:PyroDB    文件:DoActionsOncePolicy.java   
@Override
protected void runOneIteration() {
  if (actions.isEmpty()) {
    this.stop("done");
    return;
  }
  Action action = actions.remove(0);

  try {
    action.perform();
  } catch (Exception ex) {
    LOG.warn("Exception occured during performing action: "
        + StringUtils.stringifyException(ex));
  }
}
项目:PyroDB    文件:DoActionsOncePolicy.java   
@Override
public void init(PolicyContext context) throws Exception {
  super.init(context);
  for (Action action : actions) {
    action.init(this.context);
  }
}
项目:PyroDB    文件:PeriodicRandomActionPolicy.java   
public PeriodicRandomActionPolicy(long periodMs, Action... actions) {
  super(periodMs);
  this.actions = new ArrayList<Pair<Action, Integer>>(actions.length);
  for (Action action : actions) {
    this.actions.add(new Pair<Action, Integer>(action, 1));
  }
}
项目:PyroDB    文件:PeriodicRandomActionPolicy.java   
@Override
protected void runOneIteration() {
  Action action = PolicyBasedChaosMonkey.selectWeightedRandomItem(actions);
  try {
    action.perform();
  } catch (Exception ex) {
    LOG.warn("Exception occured during performing action: "
        + StringUtils.stringifyException(ex));
  }
}
项目:PyroDB    文件:PeriodicRandomActionPolicy.java   
@Override
public void init(PolicyContext context) throws Exception {
  super.init(context);
  for (Pair<Action, Integer> action : actions) {
    action.getFirst().init(this.context);
  }
}
项目:ditb    文件:IntegrationTestMTTR.java   
public ActionCallable(Action action) {
  this.action = action;
}
项目:ditb    文件:DoActionsOncePolicy.java   
public DoActionsOncePolicy(long periodMs, List<Action> actions) {
  super(periodMs);
  this.actions = new ArrayList<Action>(actions);
}
项目:ditb    文件:DoActionsOncePolicy.java   
public DoActionsOncePolicy(long periodMs, Action... actions) {
  this(periodMs, Arrays.asList(actions));
}
项目:ditb    文件:PeriodicRandomActionPolicy.java   
public PeriodicRandomActionPolicy(long periodMs, List<Pair<Action, Integer>> actions) {
  super(periodMs);
  this.actions = actions;
}