Class PolicyBasedChaosMonkey
java.lang.Object
org.apache.hadoop.hbase.chaos.monkies.ChaosMonkey
org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey
- All Implemented Interfaces:
org.apache.hadoop.hbase.Stoppable
Chaos monkey that given multiple policies will run actions against the cluster.
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
(package private) final Properties
private final ExecutorService
private static final long
private static final long
private final Policy[]
static final long
(package private) final IntegrationTestingUtility
-
Constructor Summary
ConstructorDescriptionPolicyBasedChaosMonkey
(Properties monkeyProps, IntegrationTestingUtility util, Collection<Policy> policies) PolicyBasedChaosMonkey
(Properties monkeyProps, IntegrationTestingUtility util, Policy... policies) PolicyBasedChaosMonkey
(IntegrationTestingUtility util, Collection<Policy> policies) PolicyBasedChaosMonkey
(IntegrationTestingUtility util, Policy... policies) Construct a new ChaosMonkey -
Method Summary
Modifier and TypeMethodDescriptionprivate static ExecutorService
buildMonkeyThreadPool
(int size) boolean
Returns whether the CM does destructive actions (killing servers) so that a cluster restore is needed after CM is stopped.boolean
static <T> T
selectRandomItem
(T[] items) Selects a random item from the given itemsstatic <T> List<T>
selectRandomItems
(T[] items, float ratio) Selects and returns ceil(ratio * items.length) random items from the given arraystatic <T> T
selectWeightedRandomItem
(List<org.apache.hadoop.hbase.util.Pair<T, Integer>> items) Selects a random item from the given items with weightsvoid
start()
void
void
-
Field Details
-
LOG
-
ONE_SEC
- See Also:
-
ONE_MIN
- See Also:
-
TIMEOUT
- See Also:
-
util
-
monkeyProps
-
policies
-
monkeyThreadPool
-
-
Constructor Details
-
PolicyBasedChaosMonkey
Construct a new ChaosMonkey- Parameters:
util
- the HBaseIntegrationTestingUtility already configuredpolicies
- custom policies to use
-
PolicyBasedChaosMonkey
-
PolicyBasedChaosMonkey
public PolicyBasedChaosMonkey(Properties monkeyProps, IntegrationTestingUtility util, Collection<Policy> policies) -
PolicyBasedChaosMonkey
public PolicyBasedChaosMonkey(Properties monkeyProps, IntegrationTestingUtility util, Policy... policies)
-
-
Method Details
-
buildMonkeyThreadPool
-
selectRandomItem
Selects a random item from the given items -
selectWeightedRandomItem
public static <T> T selectWeightedRandomItem(List<org.apache.hadoop.hbase.util.Pair<T, Integer>> items) Selects a random item from the given items with weights -
selectRandomItems
Selects and returns ceil(ratio * items.length) random items from the given array -
start
- Specified by:
start
in classChaosMonkey
- Throws:
Exception
-
stop
- Specified by:
stop
in interfaceorg.apache.hadoop.hbase.Stoppable
- Specified by:
stop
in classChaosMonkey
-
isStopped
- Specified by:
isStopped
in interfaceorg.apache.hadoop.hbase.Stoppable
- Specified by:
isStopped
in classChaosMonkey
-
waitForStop
- Specified by:
waitForStop
in classChaosMonkey
- Throws:
InterruptedException
-
isDestructive
Description copied from class:ChaosMonkey
Returns whether the CM does destructive actions (killing servers) so that a cluster restore is needed after CM is stopped. Otherwise cluster will be left as it is- Specified by:
isDestructive
in classChaosMonkey
-