Skip to content
Merged
Changes from 1 commit
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 number Diff line number Diff 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 Down Expand Up @@ -359,13 +360,11 @@ static boolean checkTable(Admin admin, TestOptions opts) throws IOException {
// recreate the table when user has requested presplit or when existing
// {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)
|| (!isReadCmd && desc != null
&& !StringUtils.equals(desc.getRegionSplitPolicyClassName(), opts.splitPolicy))
if ((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)
|| (desc != null && desc.getColumnFamilyCount() != opts.families)
) {
|| (desc != null && desc.getColumnFamilyCount() != opts.families)) {
needsDelete = true;
// wait, why did it delete my table?!?
LOG.debug(MoreObjects.toStringHelper("needsDelete").add("needsDelete", needsDelete)
Expand Down Expand Up @@ -728,6 +727,7 @@ static class TestOptions {
boolean cacheBlocks = true;
Scan.ReadType scanReadType = Scan.ReadType.DEFAULT;
long bufferSize = 2l * 1024l * 1024l;
Properties commandProperties;

public TestOptions() {
}
Expand Down Expand Up @@ -784,8 +784,13 @@ 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() {
return this.caching;
}
Expand Down Expand Up @@ -1149,10 +1154,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 Down Expand Up @@ -2308,7 +2313,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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change this to protected?

Copy link
Contributor Author

@gvprathyusha6 gvprathyusha6 May 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to override this in impl class, so that we can customise row format. If the custom test knows the dataset, it would be beneficial to repro any specific scenario, like if I have the rowkey similar to what tsdb puts, I can create scan load on particular dataset and write load on another and try to get closer to prod scenarios

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the methods in TestBase class are all package private? Even if you change this to protected, you can not inherit this class in other package because you can not call the constructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was managing them by using the same package name, removing it

byte[] row = generateRow(i);
Put put = new Put(row);
for (int family = 0; family < opts.families; family++) {
Expand Down Expand Up @@ -2976,6 +2981,19 @@ 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 Down Expand Up @@ -3089,9 +3107,21 @@ public int run(String[] args) throws Exception {
}

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return COMMANDS.containsKey(cmd) || isCustomTestClass(cmd);

}

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) {
CmdDescriptor descriptor = COMMANDS.get(cmd);
return descriptor != null ? descriptor.getCmdClass() : null;
Expand Down