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); }
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); }
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); }
@Override public ChaosMonkey build() { // Actions such as compact/flush a table/region, // move one region around. They are not so destructive, // can be executed more frequently. Action[] actions1 = new Action[] { new CompactTableAction(tableName, 0.5f), new CompactRandomRegionOfTableAction(tableName, 0.6f), new FlushTableAction(tableName), new FlushRandomRegionOfTableAction(tableName), new MoveRandomRegionOfTableAction(tableName) }; // Actions such as split/merge/snapshot. // They should not cause data loss, or unreliability // such as region stuck in transition. 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) }; // Destructive actions to mess things around. Action[] actions3 = new Action[] { new MoveRegionsOfTableAction(800, tableName), new MoveRandomRegionOfTableAction(800, tableName), new RestartRandomRsAction(60000), new BatchRestartRsAction(5000, 0.5f), new RestartActiveMasterAction(5000), new RollingBatchRestartRsAction(5000, 1.0f), new RestartRsHoldingMetaAction(35000) }; // Action to log more info for debugging Action[] actions4 = new Action[] { new DumpClusterStatusAction() }; return new PolicyBasedChaosMonkey(util, new PeriodicRandomActionPolicy(60 * 1000, actions1), new PeriodicRandomActionPolicy(90 * 1000, actions2), new CompositeSequentialPolicy( new DoActionsOncePolicy(150 * 1000, actions3), new PeriodicRandomActionPolicy(150 * 1000, actions3)), new PeriodicRandomActionPolicy(90 * 1000, actions4)); }