001/** 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.apache.hadoop.hbase.chaos.factories; 019 020import org.apache.hadoop.hbase.chaos.actions.*; 021import org.apache.hadoop.hbase.chaos.monkies.ChaosMonkey; 022import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey; 023import org.apache.hadoop.hbase.chaos.policies.PeriodicRandomActionPolicy; 024import org.apache.hadoop.hbase.chaos.policies.TwoConcurrentActionPolicy; 025 026/** 027 * This is a copy of NoKillMonkeyFactory that also does mob compactions. 028 */ 029public class MobNoKillMonkeyFactory extends MonkeyFactory { 030 @Override public ChaosMonkey build() { 031 Action[] actions1 = new Action[] { 032 new CompactMobAction(tableName, MonkeyConstants.DEFAULT_PERIODIC_ACTION1_PERIOD), 033 new CompactTableAction(tableName, MonkeyConstants.DEFAULT_PERIODIC_ACTION1_PERIOD), 034 new CompactRandomRegionOfTableAction(tableName, 035 MonkeyConstants.DEFAULT_COMPACT_RANDOM_REGION_RATIO), 036 new FlushTableAction(tableName), 037 new FlushRandomRegionOfTableAction(tableName), 038 new MoveRandomRegionOfTableAction(tableName) 039 }; 040 041 Action[] actions2 = new Action[] { 042 new SplitRandomRegionOfTableAction(tableName), 043 new MergeRandomAdjacentRegionsOfTableAction(tableName), 044 new SnapshotTableAction(tableName), 045 new AddColumnAction(tableName), 046 new RemoveColumnAction(tableName, columnFamilies), 047 new ChangeEncodingAction(tableName), 048 new ChangeCompressionAction(tableName), 049 new ChangeBloomFilterAction(tableName), 050 new ChangeVersionsAction(tableName) 051 }; 052 053 Action[] actions3 = new Action[] { 054 new MoveRegionsOfTableAction(MonkeyConstants.DEFAULT_MOVE_REGIONS_SLEEP_TIME, 055 MonkeyConstants.DEFAULT_MOVE_REGIONS_MAX_TIME, tableName), 056 new MoveRandomRegionOfTableAction(MonkeyConstants.DEFAULT_RESTART_ACTIVE_MASTER_SLEEP_TIME, 057 tableName), }; 058 059 Action[] actions4 = new Action[] { new DumpClusterStatusAction() }; 060 061 return new PolicyBasedChaosMonkey(util, 062 new TwoConcurrentActionPolicy(MonkeyConstants.DEFAULT_PERIODIC_ACTION1_PERIOD, actions1, 063 actions2), 064 new PeriodicRandomActionPolicy(MonkeyConstants.DEFAULT_PERIODIC_ACTION2_PERIOD,actions3), 065 new PeriodicRandomActionPolicy(MonkeyConstants.DEFAULT_PERIODIC_ACTION4_PERIOD,actions4)); 066 } 067}