Skip to content
Browse files

made warn default, cleaned up error handling on stdin

  • Loading branch information...
1 parent 6fd32a8 commit a2331fc62ced419dd49f308c16204753f0b1e0cc zznate committed Nov 23, 2010
Showing with 27 additions and 9 deletions.
  1. +25 −7 src/main/java/com/riptano/cassandra/stress/Stress.java
  2. +2 −2 src/main/resources/log4j.properties
View
32 src/main/java/com/riptano/cassandra/stress/Stress.java
@@ -111,7 +111,13 @@ private CommandLine processArgs(String[] args) throws Exception {
// reset args from no-arg if we have one
commandArgs.operation = cmd.getArgList().size() > 0 ? cmd.getArgs()[0] : commandArgs.operation;
}
- if ( commandArgs.getOperation() == Operation.REPLAY ) {
+ Operation actOpt;
+ try {
+ actOpt = commandArgs.getOperation();
+ } catch (IllegalArgumentException iae) {
+ return cmd;
+ }
+ if ( actOpt == Operation.REPLAY ) {
try {
commandArgs.replayCount = cmd.getArgList().size() > 1 ? Integer.valueOf(cmd.getArgs()[1]) : 1;
} catch (NumberFormatException nfe) {
@@ -138,10 +144,20 @@ private void initializeCommandRunner(CommandLine cmd) throws Exception {
}
if (cmd.hasOption("thrift-timeout")) {
cassandraHostConfigurator.setCassandraThriftSocketTimeout(getIntValueOrExit(cmd, "thrift-timeout"));
- }
+ }
cassandraHostConfigurator.setMaxActive(commandArgs.clients);
- cassandraHostConfigurator.setAutoDiscoverHosts(true);
- cassandraHostConfigurator.setAutoDiscoveryDelayInSeconds(10);
+
+ if (cmd.hasOption("discovery-delay")) {
+ cassandraHostConfigurator.setAutoDiscoverHosts(true);
+ cassandraHostConfigurator.setAutoDiscoveryDelayInSeconds(getIntValueOrExit(cmd, "discovery-delay"));
+ }
+ if (cmd.hasOption("retry-delay")) {
+ cassandraHostConfigurator.setRetryDownedHostsDelayInSeconds(getIntValueOrExit(cmd, "retry-delay"));
+ }
+ if (cmd.hasOption("skip-retry-delay")) {
+ cassandraHostConfigurator.setRetryDownedHosts(false);
+ }
+
Cluster cluster = HFactory.createCluster("StressCluster", cassandraHostConfigurator);
@@ -169,9 +185,11 @@ private static Options buildOptions() {
options.addOption("b","batch-size",true,"The number of rows in the batch_mutate call");
options.addOption("m","unframed",false,"Disable use of TFramedTransport");
options.addOption("w","colwidth",true,"The widht of the column in bytes. Default is 16");
- options.addOption("mw","max-wait",true,"The Maximum time to wait on aquiring a connection from the pool (maxWaitTimeWhenExhausted). Default is forever.");
- options.addOption("tt","thrift-timeout",true,"The ThriftSocketTimeout value.");
- options.addOption("concurrent",false,"Use the concurrent host pool implementation");
+ options.addOption("M","max-wait",true,"The Maximum time to wait on aquiring a connection from the pool (maxWaitTimeWhenExhausted). Default is forever.");
+ options.addOption("T","thrift-timeout",true,"The ThriftSocketTimeout value.");
+ options.addOption("D","discovery-delay",true,"The amount of time to wait between runs of Auto host discovery. Providing a value enables this service");
+ 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.");
return options;
}
View
4 src/main/resources/log4j.properties
@@ -1,4 +1,4 @@
-log4j.rootLogger=INFO,stdout,R
+log4j.rootLogger=WARN,stdout,R
# stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout
@@ -12,4 +12,4 @@ log4j.appender.R.layout.ConversionPattern=%5p [%t] %d{ISO8601} %F (line %L) %m%n
log4j.appender.R.File=stress.log
#log4j.logger.com.riptano=DEBUG
-log4j.logger.me.prettyprint=DEBUG
+#log4j.logger.me.prettyprint=DEBUG

0 comments on commit a2331fc

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