HBASE-18439 Subclasses of o.a.h.h.chaos.actions.Action all use the same logger

Signed-off-by: Jan Hentschel <jan.hentschel@ultratendency.com>
Signed-off-by: Guangxu Cheng <gxcheng@apache.org>
This commit is contained in:
ravowlga123 2019-11-08 18:56:21 +01:00 committed by Jan Hentschel
parent 72d622b7bf
commit abf6ec0d73
No known key found for this signature in database
GPG Key ID: 5CD818B19CC299A3
33 changed files with 160 additions and 37 deletions

View File

@ -27,8 +27,6 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import org.apache.commons.lang.math.RandomUtils; import org.apache.commons.lang.math.RandomUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.ClusterStatus; import org.apache.hadoop.hbase.ClusterStatus;
import org.apache.hadoop.hbase.HBaseCluster; import org.apache.hadoop.hbase.HBaseCluster;
@ -39,6 +37,8 @@ import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey; import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey;
import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* A (possibly mischievous) action that the ChaosMonkey can perform. * A (possibly mischievous) action that the ChaosMonkey can perform.
@ -64,7 +64,7 @@ public class Action {
public static final String START_NAMENODE_TIMEOUT_KEY = public static final String START_NAMENODE_TIMEOUT_KEY =
"hbase.chaosmonkey.action.startnamenodetimeout"; "hbase.chaosmonkey.action.startnamenodetimeout";
protected static final Log LOG = LogFactory.getLog(Action.class); private static final Logger LOG = LoggerFactory.getLogger(Action.class);
protected static final long KILL_MASTER_TIMEOUT_DEFAULT = PolicyBasedChaosMonkey.TIMEOUT; protected static final long KILL_MASTER_TIMEOUT_DEFAULT = PolicyBasedChaosMonkey.TIMEOUT;
protected static final long START_MASTER_TIMEOUT_DEFAULT = PolicyBasedChaosMonkey.TIMEOUT; protected static final long START_MASTER_TIMEOUT_DEFAULT = PolicyBasedChaosMonkey.TIMEOUT;

View File

@ -25,6 +25,8 @@ import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Admin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action the adds a column family to a table. * Action the adds a column family to a table.
@ -32,6 +34,7 @@ import org.apache.hadoop.hbase.client.Admin;
public class AddColumnAction extends Action { public class AddColumnAction extends Action {
private final TableName tableName; private final TableName tableName;
private Admin admin; private Admin admin;
private static final Logger LOG = LoggerFactory.getLogger(AddColumnAction.class);
public AddColumnAction(TableName tableName) { public AddColumnAction(TableName tableName) {
this.tableName = tableName; this.tableName = tableName;

View File

@ -24,12 +24,16 @@ import java.util.Set;
import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey; import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Restarts a ratio of the running regionservers at the same time * Restarts a ratio of the running regionservers at the same time
*/ */
public class BatchRestartRsAction extends RestartActionBaseAction { public class BatchRestartRsAction extends RestartActionBaseAction {
float ratio; //ratio of regionservers to restart float ratio; //ratio of regionservers to restart
private static final Logger LOG =
LoggerFactory.getLogger(BatchRestartRsAction.class);
public BatchRestartRsAction(long sleepTime, float ratio) { public BatchRestartRsAction(long sleepTime, float ratio) {
super(sleepTime); super(sleepTime);

View File

@ -26,6 +26,8 @@ import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.regionserver.BloomType; import org.apache.hadoop.hbase.regionserver.BloomType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that tries to adjust the bloom filter setting on all the columns of a * Action that tries to adjust the bloom filter setting on all the columns of a
@ -34,6 +36,7 @@ import org.apache.hadoop.hbase.regionserver.BloomType;
public class ChangeBloomFilterAction extends Action { public class ChangeBloomFilterAction extends Action {
private final long sleepTime; private final long sleepTime;
private final TableName tableName; private final TableName tableName;
private static final Logger LOG = LoggerFactory.getLogger(ChangeBloomFilterAction.class);
public ChangeBloomFilterAction(TableName tableName) { public ChangeBloomFilterAction(TableName tableName) {
this(-1, tableName); this(-1, tableName);

View File

@ -28,6 +28,9 @@ import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.io.compress.Compression.Algorithm; import org.apache.hadoop.hbase.io.compress.Compression.Algorithm;
import org.apache.hadoop.io.compress.Compressor; import org.apache.hadoop.io.compress.Compressor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that changes the compression algorithm on a column family from a list of tables. * Action that changes the compression algorithm on a column family from a list of tables.
*/ */
@ -36,6 +39,7 @@ public class ChangeCompressionAction extends Action {
private Admin admin; private Admin admin;
private Random random; private Random random;
private static final Logger LOG = LoggerFactory.getLogger(ChangeCompressionAction.class);
public ChangeCompressionAction(TableName tableName) { public ChangeCompressionAction(TableName tableName) {
this.tableName = tableName; this.tableName = tableName;

View File

@ -26,6 +26,8 @@ import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding; import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that changes the encoding on a column family from a list of tables. * Action that changes the encoding on a column family from a list of tables.
@ -35,6 +37,7 @@ public class ChangeEncodingAction extends Action {
private Admin admin; private Admin admin;
private Random random; private Random random;
private static final Logger LOG = LoggerFactory.getLogger(ChangeEncodingAction.class);
public ChangeEncodingAction(TableName tableName) { public ChangeEncodingAction(TableName tableName) {
this.tableName = tableName; this.tableName = tableName;

View File

@ -17,6 +17,8 @@
*/ */
package org.apache.hadoop.hbase.chaos.actions; package org.apache.hadoop.hbase.chaos.actions;
import java.util.Random;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
@ -24,10 +26,11 @@ import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.regionserver.ConstantSizeRegionSplitPolicy; import org.apache.hadoop.hbase.regionserver.ConstantSizeRegionSplitPolicy;
import org.apache.hadoop.hbase.regionserver.DisabledRegionSplitPolicy; import org.apache.hadoop.hbase.regionserver.DisabledRegionSplitPolicy;
import org.apache.hadoop.hbase.regionserver.IncreasingToUpperBoundRegionSplitPolicy; import org.apache.hadoop.hbase.regionserver.IncreasingToUpperBoundRegionSplitPolicy;
import org.slf4j.Logger;
import java.util.Random; import org.slf4j.LoggerFactory;
public class ChangeSplitPolicyAction extends Action { public class ChangeSplitPolicyAction extends Action {
private static final Logger LOG = LoggerFactory.getLogger(ChangeSplitPolicyAction.class);
private final TableName tableName; private final TableName tableName;
private final String[] possiblePolicies; private final String[] possiblePolicies;
private final Random random; private final Random random;

View File

@ -25,6 +25,8 @@ import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Admin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that changes the number of versions on a column family from a list of tables. * Action that changes the number of versions on a column family from a list of tables.
@ -33,6 +35,7 @@ import org.apache.hadoop.hbase.client.Admin;
*/ */
public class ChangeVersionsAction extends Action { public class ChangeVersionsAction extends Action {
private final TableName tableName; private final TableName tableName;
private static final Logger LOG = LoggerFactory.getLogger(ChangeVersionsAction.class);
private Admin admin; private Admin admin;
private Random random; private Random random;

View File

@ -26,6 +26,8 @@ import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey; import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey;
import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Admin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Region that queues a compaction of a random region from the table. * Region that queues a compaction of a random region from the table.
@ -34,6 +36,8 @@ public class CompactRandomRegionOfTableAction extends Action {
private final int majorRatio; private final int majorRatio;
private final long sleepTime; private final long sleepTime;
private final TableName tableName; private final TableName tableName;
private static final Logger LOG =
LoggerFactory.getLogger(CompactRandomRegionOfTableAction.class);
public CompactRandomRegionOfTableAction( public CompactRandomRegionOfTableAction(
TableName tableName, float majorRatio) { TableName tableName, float majorRatio) {

View File

@ -22,6 +22,8 @@ import org.apache.commons.lang.math.RandomUtils;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Admin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that queues a table compaction. * Action that queues a table compaction.
@ -30,6 +32,7 @@ public class CompactTableAction extends Action {
private final TableName tableName; private final TableName tableName;
private final int majorRatio; private final int majorRatio;
private final long sleepTime; private final long sleepTime;
private static final Logger LOG = LoggerFactory.getLogger(CompactTableAction.class);
public CompactTableAction(TableName tableName, float majorRatio) { public CompactTableAction(TableName tableName, float majorRatio) {
this(-1, tableName, majorRatio); this(-1, tableName, majorRatio);

View File

@ -20,10 +20,15 @@ package org.apache.hadoop.hbase.chaos.actions;
import java.io.IOException; import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action to dump the cluster status. * Action to dump the cluster status.
*/ */
public class DumpClusterStatusAction extends Action { public class DumpClusterStatusAction extends Action {
private static final Logger LOG =
LoggerFactory.getLogger(DumpClusterStatusAction.class);
@Override @Override
public void init(ActionContext context) throws IOException { public void init(ActionContext context) throws IOException {

View File

@ -25,11 +25,15 @@ import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey; import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey;
import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Admin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that tries to flush a random region of a table. * Action that tries to flush a random region of a table.
*/ */
public class FlushRandomRegionOfTableAction extends Action { public class FlushRandomRegionOfTableAction extends Action {
private static final Logger LOG =
LoggerFactory.getLogger(FlushRandomRegionOfTableAction.class);
private final long sleepTime; private final long sleepTime;
private final TableName tableName; private final TableName tableName;

View File

@ -21,11 +21,15 @@ package org.apache.hadoop.hbase.chaos.actions;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Admin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that tries to flush a table. * Action that tries to flush a table.
*/ */
public class FlushTableAction extends Action { public class FlushTableAction extends Action {
private static final Logger LOG =
LoggerFactory.getLogger(FlushTableAction.class);
private final long sleepTime; private final long sleepTime;
private final TableName tableName; private final TableName tableName;

View File

@ -18,10 +18,16 @@
package org.apache.hadoop.hbase.chaos.actions; package org.apache.hadoop.hbase.chaos.actions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that tries to force a balancer run. * Action that tries to force a balancer run.
*/ */
public class ForceBalancerAction extends Action { public class ForceBalancerAction extends Action {
private static final Logger LOG =
LoggerFactory.getLogger(ForceBalancerAction.class);
@Override @Override
public void perform() throws Exception { public void perform() throws Exception {
// Don't try the flush if we're stopping // Don't try the flush if we're stopping

View File

@ -25,11 +25,15 @@ import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Admin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action to merge regions of a table. * Action to merge regions of a table.
*/ */
public class MergeRandomAdjacentRegionsOfTableAction extends Action { public class MergeRandomAdjacentRegionsOfTableAction extends Action {
private static final Logger LOG =
LoggerFactory.getLogger(MergeRandomAdjacentRegionsOfTableAction.class);
private final TableName tableName; private final TableName tableName;
private final long sleepTime; private final long sleepTime;

View File

@ -25,11 +25,15 @@ import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey; import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey;
import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Admin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that tries to move a random region of a table. * Action that tries to move a random region of a table.
*/ */
public class MoveRandomRegionOfTableAction extends Action { public class MoveRandomRegionOfTableAction extends Action {
private static final Logger LOG =
LoggerFactory.getLogger(MoveRandomRegionOfTableAction.class);
private final long sleepTime; private final long sleepTime;
private final TableName tableName; private final TableName tableName;

View File

@ -29,11 +29,15 @@ import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.chaos.factories.MonkeyConstants; import org.apache.hadoop.hbase.chaos.factories.MonkeyConstants;
import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that tries to move every region of a table. * Action that tries to move every region of a table.
*/ */
public class MoveRegionsOfTableAction extends Action { public class MoveRegionsOfTableAction extends Action {
private static final Logger LOG =
LoggerFactory.getLogger(MoveRegionsOfTableAction.class);
private final long sleepTime; private final long sleepTime;
private final TableName tableName; private final TableName tableName;
private final long maxTime; private final long maxTime;

View File

@ -27,11 +27,15 @@ import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that removes a column family. * Action that removes a column family.
*/ */
public class RemoveColumnAction extends Action { public class RemoveColumnAction extends Action {
private static final Logger LOG =
LoggerFactory.getLogger(RemoveColumnAction.class);
private final TableName tableName; private final TableName tableName;
private final Set<String> protectedColumns; private final Set<String> protectedColumns;
private Admin admin; private Admin admin;

View File

@ -22,11 +22,15 @@ import java.io.IOException;
import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.util.Threads; import org.apache.hadoop.hbase.util.Threads;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Base class for restarting HBaseServer's * Base class for restarting HBaseServer's
*/ */
public class RestartActionBaseAction extends Action { public class RestartActionBaseAction extends Action {
private static final Logger LOG =
LoggerFactory.getLogger(RestartActionBaseAction.class);
long sleepTime; // how long should we sleep long sleepTime; // how long should we sleep
public RestartActionBaseAction(long sleepTime) { public RestartActionBaseAction(long sleepTime) {

View File

@ -19,11 +19,15 @@
package org.apache.hadoop.hbase.chaos.actions; package org.apache.hadoop.hbase.chaos.actions;
import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.ServerName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that tries to restart the active master. * Action that tries to restart the active master.
*/ */
public class RestartActiveMasterAction extends RestartActionBaseAction { public class RestartActiveMasterAction extends RestartActionBaseAction {
private static final Logger LOG = LoggerFactory.getLogger(RestartActionBaseAction.class);
public RestartActiveMasterAction(long sleepTime) { public RestartActiveMasterAction(long sleepTime) {
super(sleepTime); super(sleepTime);
} }

View File

@ -29,11 +29,15 @@ import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
import org.apache.hadoop.hdfs.DFSUtil; import org.apache.hadoop.hdfs.DFSUtil;
import org.apache.hadoop.hdfs.HAUtil; import org.apache.hadoop.hdfs.HAUtil;
import org.apache.hadoop.hdfs.server.namenode.ha.proto.HAZKInfoProtos.ActiveNodeInfo; import org.apache.hadoop.hdfs.server.namenode.ha.proto.HAZKInfoProtos.ActiveNodeInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that tries to restart the active namenode. * Action that tries to restart the active namenode.
*/ */
public class RestartActiveNameNodeAction extends RestartActionBaseAction { public class RestartActiveNameNodeAction extends RestartActionBaseAction {
private static final Logger LOG =
LoggerFactory.getLogger(RestartActiveNameNodeAction.class);
// Value taken from org.apache.hadoop.ha.ActiveStandbyElector.java, variable :- LOCK_FILENAME // Value taken from org.apache.hadoop.ha.ActiveStandbyElector.java, variable :- LOCK_FILENAME
private static final String ACTIVE_NN_LOCK_NAME = "ActiveStandbyElectorLock"; private static final String ACTIVE_NN_LOCK_NAME = "ActiveStandbyElectorLock";

View File

@ -18,6 +18,10 @@
package org.apache.hadoop.hbase.chaos.actions; package org.apache.hadoop.hbase.chaos.actions;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey; import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey;
import org.apache.hadoop.hbase.util.FSUtils; import org.apache.hadoop.hbase.util.FSUtils;
@ -25,15 +29,15 @@ import org.apache.hadoop.hdfs.DFSClient;
import org.apache.hadoop.hdfs.DistributedFileSystem; import org.apache.hadoop.hdfs.DistributedFileSystem;
import org.apache.hadoop.hdfs.protocol.DatanodeInfo; import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
import org.apache.hadoop.hdfs.protocol.HdfsConstants; import org.apache.hadoop.hdfs.protocol.HdfsConstants;
import org.slf4j.Logger;
import java.io.IOException; import org.slf4j.LoggerFactory;
import java.util.LinkedList;
import java.util.List;
/** /**
* Action that restarts a random datanode. * Action that restarts a random datanode.
*/ */
public class RestartRandomDataNodeAction extends RestartActionBaseAction { public class RestartRandomDataNodeAction extends RestartActionBaseAction {
private static final Logger LOG = LoggerFactory.getLogger(RestartRandomDataNodeAction.class);
public RestartRandomDataNodeAction(long sleepTime) { public RestartRandomDataNodeAction(long sleepTime) {
super(sleepTime); super(sleepTime);
} }

View File

@ -20,11 +20,15 @@ package org.apache.hadoop.hbase.chaos.actions;
import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey; import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that restarts a random HRegionServer * Action that restarts a random HRegionServer
*/ */
public class RestartRandomRsAction extends RestartActionBaseAction { public class RestartRandomRsAction extends RestartActionBaseAction {
private static final Logger LOG = LoggerFactory.getLogger(RestartRandomRsAction.class);
public RestartRandomRsAction(long sleepTime) { public RestartRandomRsAction(long sleepTime) {
super(sleepTime); super(sleepTime);
} }

View File

@ -21,11 +21,15 @@ package org.apache.hadoop.hbase.chaos.actions;
import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey; import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey;
import org.apache.hadoop.hbase.zookeeper.ZKServerTool; import org.apache.hadoop.hbase.zookeeper.ZKServerTool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that restarts a random zookeeper node. * Action that restarts a random zookeeper node.
*/ */
public class RestartRandomZKNodeAction extends RestartActionBaseAction { public class RestartRandomZKNodeAction extends RestartActionBaseAction {
private static final Logger LOG = LoggerFactory.getLogger(RestartRandomZKNodeAction.class);
public RestartRandomZKNodeAction(long sleepTime) { public RestartRandomZKNodeAction(long sleepTime) {
super(sleepTime); super(sleepTime);
} }

View File

@ -20,11 +20,16 @@ package org.apache.hadoop.hbase.chaos.actions;
import org.apache.hadoop.hbase.ClusterStatus; import org.apache.hadoop.hbase.ClusterStatus;
import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.ServerName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that tries to restart the HRegionServer holding Meta. * Action that tries to restart the HRegionServer holding Meta.
*/ */
public class RestartRsHoldingMetaAction extends RestartActionBaseAction { public class RestartRsHoldingMetaAction extends RestartActionBaseAction {
private static final Logger LOG =
LoggerFactory.getLogger(RestartRsHoldingMetaAction.class);
public RestartRsHoldingMetaAction(long sleepTime) { public RestartRsHoldingMetaAction(long sleepTime) {
super(sleepTime); super(sleepTime);
} }

View File

@ -26,11 +26,15 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.HTable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that restarts an HRegionServer holding one of the regions of the table. * Action that restarts an HRegionServer holding one of the regions of the table.
*/ */
public class RestartRsHoldingTableAction extends RestartActionBaseAction { public class RestartRsHoldingTableAction extends RestartActionBaseAction {
private static final Logger LOG =
LoggerFactory.getLogger(RestartRsHoldingTableAction.class);
private final String tableName; private final String tableName;

View File

@ -32,8 +32,9 @@ import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey;
/** /**
* Restarts a ratio of the regionservers in a rolling fashion. At each step, either kills a * Restarts a ratio of the regionservers in a rolling fashion. At each step, either kills a
* server, or starts one, sleeping randomly (0-sleepTime) in between steps. The parameter maxDeadServers * server, or starts one, sleeping randomly (0-sleepTime) in between steps.
* limits the maximum number of servers that can be down at the same time during rolling restarts. * The parameter maxDeadServers limits the maximum number of servers that
* can be down at the same time during rolling restarts.
*/ */
public class RollingBatchRestartRsAction extends BatchRestartRsAction { public class RollingBatchRestartRsAction extends BatchRestartRsAction {
private static final Log LOG = LogFactory.getLog(RollingBatchRestartRsAction.class); private static final Log LOG = LogFactory.getLog(RollingBatchRestartRsAction.class);

View File

@ -21,11 +21,15 @@ package org.apache.hadoop.hbase.chaos.actions;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Admin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that tries to take a snapshot of a table. * Action that tries to take a snapshot of a table.
*/ */
public class SnapshotTableAction extends Action { public class SnapshotTableAction extends Action {
private static final Logger LOG =
LoggerFactory.getLogger(SnapshotTableAction.class);
private final TableName tableName; private final TableName tableName;
private final long sleepTime; private final long sleepTime;

View File

@ -17,15 +17,19 @@
*/ */
package org.apache.hadoop.hbase.chaos.actions; package org.apache.hadoop.hbase.chaos.actions;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SplitAllRegionOfTableAction extends Action { public class SplitAllRegionOfTableAction extends Action {
private static final Logger LOG =
LoggerFactory.getLogger(SplitAllRegionOfTableAction.class);
private static final int DEFAULT_MAX_SPLITS = 3; private static final int DEFAULT_MAX_SPLITS = 3;
private static final String MAX_SPLIT_KEY = "hbase.chaosmonkey.action.maxFullTableSplits"; private static final String MAX_SPLIT_KEY = "hbase.chaosmonkey.action.maxFullTableSplits";

View File

@ -25,11 +25,15 @@ import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey; import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey;
import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Admin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that tries to split a random region of a table. * Action that tries to split a random region of a table.
*/ */
public class SplitRandomRegionOfTableAction extends Action { public class SplitRandomRegionOfTableAction extends Action {
private static final Logger LOG =
LoggerFactory.getLogger(SplitRandomRegionOfTableAction.class);
private final long sleepTime; private final long sleepTime;
private final TableName tableName; private final TableName tableName;

View File

@ -24,11 +24,15 @@ import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that tries to truncate of a table. * Action that tries to truncate of a table.
*/ */
public class TruncateTableAction extends Action { public class TruncateTableAction extends Action {
private static final Logger LOG =
LoggerFactory.getLogger(TruncateTableAction.class);
private final TableName tableName; private final TableName tableName;
private final Random random; private final Random random;

View File

@ -28,9 +28,13 @@ import org.apache.commons.lang.math.RandomUtils;
import org.apache.hadoop.hbase.ClusterStatus; import org.apache.hadoop.hbase.ClusterStatus;
import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.ServerName;
import org.junit.Assert; import org.junit.Assert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** This action is too specific to put in ChaosMonkey; put it here */ /** This action is too specific to put in ChaosMonkey; put it here */
public class UnbalanceKillAndRebalanceAction extends Action { public class UnbalanceKillAndRebalanceAction extends Action {
private static final Logger LOG =
LoggerFactory.getLogger(UnbalanceKillAndRebalanceAction.class);
/** Fractions of servers to get regions and live and die respectively; from all other /** Fractions of servers to get regions and live and die respectively; from all other
* servers, HOARD_FRC_OF_REGIONS will be removed to the above randomly */ * servers, HOARD_FRC_OF_REGIONS will be removed to the above randomly */
private static final double FRC_SERVERS_THAT_HOARD_AND_LIVE = 0.1; private static final double FRC_SERVERS_THAT_HOARD_AND_LIVE = 0.1;

View File

@ -25,11 +25,15 @@ import java.util.List;
import org.apache.commons.lang.math.RandomUtils; import org.apache.commons.lang.math.RandomUtils;
import org.apache.hadoop.hbase.ClusterStatus; import org.apache.hadoop.hbase.ClusterStatus;
import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.ServerName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Action that tries to unbalance the regions of a cluster. * Action that tries to unbalance the regions of a cluster.
*/ */
public class UnbalanceRegionsAction extends Action { public class UnbalanceRegionsAction extends Action {
private static final Logger LOG =
LoggerFactory.getLogger(UnbalanceRegionsAction.class);
private double fractionOfRegions; private double fractionOfRegions;
private double fractionOfServers; private double fractionOfServers;