Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,6 +36,7 @@
import java.util.Locale;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Properties;
import java.util.Queue;
import java.util.Random;
import java.util.TreeMap;
Expand DownExpand Up@@ -358,7 +359,8 @@ static boolean checkTable(Admin admin, TestOptions opts) throws IOException {
// {RegionSplitPolicy,replica count} does not match requested, or when the
// number of column families does not match requested.
if (
(exists && opts.presplitRegions != DEFAULT_OPTS.presplitRegions)
(exists && opts.presplitRegions != DEFAULT_OPTS.presplitRegions
&& opts.presplitRegions != admin.getRegions(tableName).size())
|| (!isReadCmd && desc != null
&& !StringUtils.equals(desc.getRegionSplitPolicyClassName(), opts.splitPolicy))
|| (!isReadCmd && desc != null && desc.getRegionReplication() != opts.replicas)
Expand DownExpand Up@@ -719,6 +721,7 @@ static class TestOptions {
boolean cacheBlocks = true;
Scan.ReadType scanReadType = Scan.ReadType.DEFAULT;
long bufferSize = 2l * 1024l * 1024l;
Properties commandProperties;

public TestOptions() {
}
Expand DownExpand Up@@ -775,6 +778,11 @@ public TestOptions(TestOptions that) {
this.cacheBlocks = that.cacheBlocks;
this.scanReadType = that.scanReadType;
this.bufferSize = that.bufferSize;
this.commandProperties = that.commandProperties;
}

public Properties getCommandProperties() {
return commandProperties;
}

public int getCaching() {
Expand DownExpand Up@@ -1140,10 +1148,10 @@ private static long nextRandomSeed() {
protected final Configuration conf;
protected final TestOptions opts;

private final Status status;
protected final Status status;

private String testName;
private Histogram latencyHistogram;
protected Histogram latencyHistogram;
private Histogram replicaLatencyHistogram;
private Histogram valueSizeHistogram;
private Histogram rpcCallsHistogram;
Expand DownExpand Up@@ -2300,7 +2308,7 @@ protected byte[] generateRow(final int i) {
}

@Override
boolean testRow(final int i, final long startTime) throws IOException {
protected boolean testRow(final int i, final long startTime) throws IOException {
byte[] row = generateRow(i);
Put put = new Put(row);
for (int family = 0; family < opts.families; family++) {
Expand DownExpand Up@@ -2673,6 +2681,8 @@ protected static void printUsage(final String shortName, final String message) {
for (CmdDescriptor command : COMMANDS.values()) {
System.err.println(String.format(" %-20s %s", command.getName(), command.getDescription()));
}
System.err.println(String.format(" %-20s %s", "? extends Test",
"Run custom implementation of provided Test present in classpath"));
System.err.println();
System.err.println("Args:");
System.err.println(" nclients Integer. Required. Total number of clients "
Expand DownExpand Up@@ -2968,6 +2978,20 @@ static TestOptions parseOpts(Queue<String> args) {
continue;
}

final String commandPropertiesFile = "--commandPropertiesFile=";
if (cmd.startsWith(commandPropertiesFile)) {
String fileName = String.valueOf(cmd.substring(commandPropertiesFile.length()));
Properties properties = new Properties();
try {
properties
.load(PerformanceEvaluation.class.getClassLoader().getResourceAsStream(fileName));
opts.commandProperties = properties;
} catch (IOException e) {
LOG.error("Failed to load metricIds from properties file", e);
}
continue;
}

validateParsedOpts(opts);

if (isCommandClass(cmd)) {
Expand DownExpand Up@@ -3081,7 +3105,20 @@ public int run(String[] args) throws Exception {
}

private static boolean isCommandClass(String cmd) {
return COMMANDS.containsKey(cmd);
return !COMMANDS.containsKey(cmd) ? isCustomTestClass(cmd) : true;
}

private static boolean isCustomTestClass(String cmd) {
Class<? extends Test> cmdClass;
try {
cmdClass =
(Class<? extends Test>) PerformanceEvaluation.class.getClassLoader().loadClass(cmd);
addCommandDescriptor(cmdClass, cmd, "custom command");
return true;
} catch (Throwable th) {
LOG.info("No class found for command: " + cmd, th);
return false;
}
}

private static Class<? extends TestBase> determineCommandClass(String cmd) {
Expand Down