Skip to content
Browse files

added startkey option

  • Loading branch information...
1 parent 736651a commit ba650e1879efd6136ab6e6f322bc33f7e3116edd zznate committed Mar 25, 2011
View
2 pom.xml
@@ -55,7 +55,7 @@
<name>stress</name>
</program>
</programs>
- <extraJvmArguments>-agentpath:/usr/local/yjp/bin/linux-x86-64/libyjpagent.so</extraJvmArguments>
+ <!-- <extraJvmArguments>-agentpath:/usr/local/yjp/bin/linux-x86-64/libyjpagent.so</extraJvmArguments> -->
<repositoryLayout>flat</repositoryLayout>
</configuration>
<executions>
View
2 src/main/java/com/riptano/cassandra/stress/CommandArgs.java
@@ -13,6 +13,7 @@
public int threads = DEF_CLIENTS;
public int clients = DEF_CLIENTS;
public int replayCount = DEF_REPLAY_COUNT;
+ public int startKey = DEF_START_KEY;
public String workingKeyspace = DEF_KEYSPACE;
public String workingColumnFamily = DEF_COLUMN_FAMILY;
@@ -23,6 +24,7 @@
private static String DEF_OPERATION = "insert";
private static int DEF_REPLAY_COUNT = 0;
private static int DEF_COLUMN_WIDTH = 16;
+ private static int DEF_START_KEY = 0;
private static String DEF_KEYSPACE = "StressKeyspace";
private static String DEF_COLUMN_FAMILY = "StressStandard";
View
8 src/main/java/com/riptano/cassandra/stress/CommandRunner.java
@@ -68,7 +68,13 @@ public void processCommand(CommandArgs commandArgs) throws Exception {
}
}
- private StressCommand getCommandInstance(int startKey, CommandArgs commandArgs, CommandRunner commandRunner) {
+ private StressCommand getCommandInstance(int startKeyArg, CommandArgs commandArgs, CommandRunner commandRunner) {
+
+ int startKey = commandArgs.startKey + startKeyArg;
+ if ( log.isDebugEnabled() ) {
+ log.debug("Command requested with starting key pos {}", startKey);
+ }
+
Operation operation = commandArgs.getOperation();
if ( operation.equals(Operation.REPLAY )) {
operation = previousOperation;
View
7 src/main/java/com/riptano/cassandra/stress/Stress.java
@@ -90,7 +90,11 @@ private CommandLine processArgs(String[] args) throws Exception {
if (cmd.hasOption("clients")) {
commandArgs.clients = getIntValueOrExit(cmd, "clients");
}
-
+
+ if (cmd.hasOption("start-key")) {
+ commandArgs.startKey = getIntValueOrExit(cmd, "start-key");
+ }
+
if ( cmd.hasOption("num-keys") ) {
commandArgs.rowCount = getIntValueOrExit(cmd, "num-keys");
@@ -206,6 +210,7 @@ private static Options buildOptions() {
options.addOption("R","retry-delay",true,"The amount of time to wait between runs of Downed host retry delay execution. 30 seconds by default.");
options.addOption("S","skip-retry-delay",false,"Disable downed host retry service execution.");
options.addOption("L","consistency-levels",true,"Defaults to QUORUM for R+W, specified in the form of [read]:[write] eg. '-L ONE:ONE'");
+ options.addOption("k","start-key",true,"Start on a specific key");
return options;
}

0 comments on commit ba650e1

Please sign in to comment.
Something went wrong with that request. Please try again.