1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.hadoop.hbase.chaos.factories;
19
20 import org.apache.hadoop.hbase.chaos.actions.*;
21 import org.apache.hadoop.hbase.chaos.monkies.ChaosMonkey;
22 import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey;
23 import org.apache.hadoop.hbase.chaos.policies.PeriodicRandomActionPolicy;
24 import org.apache.hadoop.hbase.chaos.policies.TwoConcurrentActionPolicy;
25
26
27
28
29 public class MobNoKillMonkeyFactory extends MonkeyFactory {
30 @Override public ChaosMonkey build() {
31 Action[] actions1 = new Action[] {
32 new CompactMobAction(tableName, MonkeyConstants.DEFAULT_PERIODIC_ACTION1_PERIOD),
33 new CompactTableAction(tableName, MonkeyConstants.DEFAULT_PERIODIC_ACTION1_PERIOD),
34 new CompactRandomRegionOfTableAction(tableName,
35 MonkeyConstants.DEFAULT_COMPACT_RANDOM_REGION_RATIO),
36 new FlushTableAction(tableName),
37 new FlushRandomRegionOfTableAction(tableName),
38 new MoveRandomRegionOfTableAction(tableName)
39 };
40
41 Action[] actions2 = new Action[] {
42 new SplitRandomRegionOfTableAction(tableName),
43 new MergeRandomAdjacentRegionsOfTableAction(tableName),
44 new SnapshotTableAction(tableName),
45 new AddColumnAction(tableName),
46 new RemoveColumnAction(tableName, columnFamilies),
47 new ChangeEncodingAction(tableName),
48 new ChangeCompressionAction(tableName),
49 new ChangeBloomFilterAction(tableName),
50 new ChangeVersionsAction(tableName)
51 };
52
53 Action[] actions3 = new Action[] {
54 new MoveRegionsOfTableAction(MonkeyConstants.DEFAULT_MOVE_REGIONS_SLEEP_TIME,
55 MonkeyConstants.DEFAULT_MOVE_REGIONS_MAX_TIME,
56 tableName),
57 new MoveRandomRegionOfTableAction(MonkeyConstants.DEFAULT_RESTART_ACTIVE_MASTER_SLEEP_TIME,
58 tableName),
59 };
60
61 Action[] actions4 = new Action[] {
62 new DumpClusterStatusAction()
63 };
64
65 return new PolicyBasedChaosMonkey(util,
66 new TwoConcurrentActionPolicy(MonkeyConstants.DEFAULT_PERIODIC_ACTION1_PERIOD, actions1, actions2),
67 new PeriodicRandomActionPolicy(MonkeyConstants.DEFAULT_PERIODIC_ACTION2_PERIOD,actions3),
68 new PeriodicRandomActionPolicy(MonkeyConstants.DEFAULT_PERIODIC_ACTION4_PERIOD,actions4));
69 }
70 }