HBASE-9370 Add logging to Schema change Chaos actions.

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1518412 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
eclark 2013-08-28 22:59:12 +00:00
parent f8c51ac73b
commit b3cfe061e1
4 changed files with 14 additions and 2 deletions

View File

@ -32,9 +32,11 @@ import org.apache.hadoop.hbase.util.Bytes;
*/
public class AddColumnAction extends Action {
private final byte[] tableName;
private final String tableNameString;
private HBaseAdmin admin;
public AddColumnAction(String tableName) {
tableNameString = tableName;
this.tableName = Bytes.toBytes(tableName);
}
@ -54,6 +56,8 @@ public class AddColumnAction extends Action {
columnDescriptor = new HColumnDescriptor(RandomStringUtils.randomAlphabetic(5));
}
LOG.debug("Performing action: Adding " + columnDescriptor + " to " + tableNameString);
tableDescriptor.addFamily(columnDescriptor);
admin.modifyTable(tableName, tableDescriptor);
}

View File

@ -32,11 +32,13 @@ import org.apache.hadoop.hbase.util.Bytes;
*/
public class ChangeEncodingAction extends Action {
private final byte[] tableName;
private final String tableNameString;
private HBaseAdmin admin;
private Random random;
public ChangeEncodingAction(String tableName) {
tableNameString = tableName;
this.tableName = Bytes.toBytes(tableName);
this.random = new Random();
}
@ -56,6 +58,7 @@ public class ChangeEncodingAction extends Action {
return;
}
LOG.debug("Performing action: Changing encodings on " + tableNameString);
// possible DataBlockEncoding id's
int[] possibleIds = {0, 2, 3, 4, 6};
for (HColumnDescriptor descriptor : columnDescriptors) {

View File

@ -33,11 +33,13 @@ import org.apache.hadoop.hbase.util.Bytes;
*/
public class ChangeVersionsAction extends Action {
private final byte[] tableName;
private final String tableNameString;
private HBaseAdmin admin;
private Random random;
public ChangeVersionsAction(String tableName) {
tableNameString = tableName;
this.tableName = Bytes.toBytes(tableName);
this.random = new Random();
}
@ -62,7 +64,7 @@ public class ChangeVersionsAction extends Action {
descriptor.setMaxVersions(versions);
descriptor.setMinVersions(versions);
}
LOG.debug("Performing action: Changing versions on " + tableNameString);
admin.modifyTable(tableName, tableDescriptor);
}
}

View File

@ -33,10 +33,12 @@ import org.apache.hadoop.hbase.util.Bytes;
public class RemoveColumnAction extends Action {
private final byte[] tableName;
private final Set<String> protectedColumns;
private final String tableNameString;
private HBaseAdmin admin;
private Random random;
public RemoveColumnAction(String tableName, Set<String> protectedColumns) {
tableNameString = tableName;
this.tableName = Bytes.toBytes(tableName);
this.protectedColumns = protectedColumns;
random = new Random();
@ -62,7 +64,8 @@ public class RemoveColumnAction extends Action {
protectedColumns.contains(columnDescriptors[index].getNameAsString())) {
index = random.nextInt(columnDescriptors.length);
}
LOG.debug("Performing action: Removing " + columnDescriptors[index].getName() + " from "
+ tableNameString);
tableDescriptor.removeFamily(columnDescriptors[index].getName());
admin.modifyTable(tableName, tableDescriptor);