Skip to content
Browse files

Merge remote branch 'origin/master'

Conflicts:
	pom.xml
  • Loading branch information...
2 parents 2cfc36f + 43ccbd1 commit 8c9cb72ac650168b3420a27d5b7f728890371e63 @patricioe patricioe committed Sep 2, 2011
Showing with 27 additions and 17 deletions.
  1. +1 −1 pom.xml
  2. +23 −13 src/main/java/com/riptano/cassandra/stress/InsertCommand.java
  3. +3 −3 stress-schema.txt
View
2 pom.xml
@@ -4,7 +4,7 @@
<groupId>com.riptano.cassandra.stress</groupId>
<artifactId>cassandra-stress</artifactId>
- <version>0.8.3_1</version>
+ <version>0.8_1</version>
<packaging>jar</packaging>
<name>cassandra-stress</name>
View
36 src/main/java/com/riptano/cassandra/stress/InsertCommand.java
@@ -41,26 +41,18 @@ public Void call() throws Exception {
key = String.format(KEY_FORMAT, rows+startKey);
for (int j2 = 0; j2 < commandArgs.columnCount; j2++) {
mutator.addInsertion(key, commandArgs.workingColumnFamily, HFactory.createStringColumn(String.format(COLUMN_NAME_FORMAT, j2),
- String.format(COLUMN_VAL_FORMAT, j2, RandomStringUtils.random(colWidth))));
+ String.format(COLUMN_VAL_FORMAT, j2, RandomStringUtils.random(colWidth))));
+ if ( j2 > 0 && j2 % commandArgs.batchSize == 0 ) {
+ executeMutator(rows);
+ }
}
if (++rows == commandArgs.getKeysPerThread() ) {
break;
}
}
- try {
- MutationResult mr = mutator.execute();
- LatencyTracker writeCount = commandRunner.latencies.get(mr.getHostUsed());
- if ( writeCount != null )
- writeCount.addMicro(mr.getExecutionTimeMicro());
- mutator.discardPendingMutations();
-
- log.info("executed batch of {}. {} of {} complete", new Object[]{commandArgs.batchSize, rows, commandArgs.getKeysPerThread()});
-
- } catch (Exception ex){
- log.error("Problem executing insert:",ex);
- }
+ executeMutator(rows);
}
commandRunner.doneSignal.countDown();
log.info("Last key was: {} for thread {}", key, Thread.currentThread().getId());
@@ -73,6 +65,24 @@ public Void call() throws Exception {
log.info("Executed chunk of {}. Latch now at {}", commandArgs.getKeysPerThread(), commandRunner.doneSignal.getCount());
return null;
}
+
+ private void executeMutator(int rows) {
+ try {
+ MutationResult mr = mutator.execute();
+ // could be null here when our batch size is zero
+ if ( mr.getHostUsed() != null ) {
+ LatencyTracker writeCount = commandRunner.latencies.get(mr.getHostUsed());
+ if ( writeCount != null )
+ writeCount.addMicro(mr.getExecutionTimeMicro());
+ }
+ mutator.discardPendingMutations();
+
+ log.info("executed batch of {}. {} of {} complete", new Object[]{commandArgs.batchSize, rows, commandArgs.getKeysPerThread()});
+
+ } catch (Exception ex){
+ log.error("Problem executing insert:",ex);
+ }
+ }
private static final String COLUMN_VAL_FORMAT = "%08d_%s";
private static final String COLUMN_NAME_FORMAT = "col_%08d";
View
6 stress-schema.txt
@@ -1,6 +1,6 @@
-create keyspace StressKeyspace
- with replication_factor = 1
- and placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy';
+create keyspace StressKeyspace
+ with placement_strategy = 'SimpleStrategy'
+ and strategy_options = [{replication_factor : 1}];
use StressKeyspace;
drop column family StressStandard;

0 comments on commit 8c9cb72

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