Repository: cassandra Updated Branches: refs/heads/cassandra-2.1 c45ed1714 -> bedd97f7a refs/heads/trunk 31099a167 -> 7783f130c
fix up misapply of CASSANDRA-7964 nits Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f8524011 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f8524011 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f8524011 Branch: refs/heads/cassandra-2.1 Commit: f852401166cdd1e6b2136b5e70b85a771f6f2a8f Parents: d5e5f98 Author: Benedict Elliott Smith <bened...@apache.org> Authored: Wed Dec 17 09:27:47 2014 +0000 Committer: Benedict Elliott Smith <bened...@apache.org> Committed: Wed Dec 17 09:27:47 2014 +0000 ---------------------------------------------------------------------- .../apache/cassandra/stress/generate/PartitionIterator.java | 7 +++---- .../cassandra/stress/operations/userdefined/SchemaInsert.java | 7 +------ .../cassandra/stress/operations/userdefined/SchemaQuery.java | 7 +------ 3 files changed, 5 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/f8524011/tools/stress/src/org/apache/cassandra/stress/generate/PartitionIterator.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/stress/generate/PartitionIterator.java b/tools/stress/src/org/apache/cassandra/stress/generate/PartitionIterator.java index baab867..0d0cba1 100644 --- a/tools/stress/src/org/apache/cassandra/stress/generate/PartitionIterator.java +++ b/tools/stress/src/org/apache/cassandra/stress/generate/PartitionIterator.java @@ -169,7 +169,6 @@ public abstract class PartitionIterator implements Iterator<Row> // so that we know with what chance we reached there, and we adjust our roll at that level by that amount final double[] chancemodifier = new double[generator.clusteringComponents.size()]; final double[] rollmodifier = new double[generator.clusteringComponents.size()]; - final ThreadLocalRandom random = ThreadLocalRandom.current(); // track where in the partition we are, and where we are limited to final int[] position = new int[generator.clusteringComponents.size()]; @@ -240,7 +239,7 @@ public abstract class PartitionIterator implements Iterator<Row> } // seek to our start position - switch (seek(isWrite ? position : null)) + switch (seek(isWrite ? position : 0)) { case END_OF_PARTITION: return false; @@ -382,6 +381,7 @@ public abstract class PartitionIterator implements Iterator<Row> private boolean advance(int depth, boolean first) { + ThreadLocalRandom random = ThreadLocalRandom.current(); // advance the leaf component clusteringComponents[depth].poll(); position[depth]++; @@ -548,9 +548,9 @@ public abstract class PartitionIterator implements Iterator<Row> private State setHasNext(boolean hasNext) { + this.hasNext = hasNext; if (!hasNext) { - this.hasNext = false; boolean isLast = finishedPartition(); if (isWrite) { @@ -562,7 +562,6 @@ public abstract class PartitionIterator implements Iterator<Row> } return isLast ? State.END_OF_PARTITION : State.AFTER_LIMIT; } - this.hasNext = hasNext; return State.SUCCESS; } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/f8524011/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaInsert.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaInsert.java b/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaInsert.java index 61237f1..a915d93 100644 --- a/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaInsert.java +++ b/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaInsert.java @@ -44,15 +44,10 @@ public class SchemaInsert extends SchemaStatement public SchemaInsert(Timer timer, StressSettings settings, PartitionGenerator generator, SeedManager seedManager, Distribution batchSize, RatioDistribution useRatio, Integer thriftId, PreparedStatement statement, ConsistencyLevel cl, BatchStatement.Type batchType) { - super(timer, settings, spec(generator, seedManager, batchSize, useRatio), statement, thriftId, cl, ValidationType.NOT_FAIL); + super(timer, settings, new DataSpec(generator, seedManager, batchSize, useRatio), statement, thriftId, cl, ValidationType.NOT_FAIL); this.batchType = batchType; } - private static DataSpec spec(PartitionGenerator generator, SeedManager seedManager, Distribution partitionCount, RatioDistribution useRatio) - { - return new DataSpec(generator, seedManager, partitionCount, useRatio); - } - private class JavaDriverRun extends Runner { final JavaDriverClient client; http://git-wip-us.apache.org/repos/asf/cassandra/blob/f8524011/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaQuery.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaQuery.java b/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaQuery.java index 72db2f7..a51bac4 100644 --- a/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaQuery.java +++ b/tools/stress/src/org/apache/cassandra/stress/operations/userdefined/SchemaQuery.java @@ -54,16 +54,11 @@ public class SchemaQuery extends SchemaStatement public SchemaQuery(Timer timer, StressSettings settings, PartitionGenerator generator, SeedManager seedManager, Integer thriftId, PreparedStatement statement, ConsistencyLevel cl, ValidationType validationType, ArgSelect argSelect) { - super(timer, settings, spec(generator, seedManager, statement.getVariables().size(), argSelect), statement, thriftId, cl, validationType); + super(timer, settings, new DataSpec(generator, seedManager, new DistributionFixed(1), argSelect == ArgSelect.MULTIROW ? statement.getVariables().size() : 1), statement, thriftId, cl, validationType); this.argSelect = argSelect; randomBuffer = new Object[argumentIndex.length][argumentIndex.length]; } - static DataSpec spec(PartitionGenerator generator, SeedManager seedManager, int argCount, ArgSelect argSelect) - { - return new DataSpec(generator, seedManager, new DistributionFixed(1), argSelect == ArgSelect.MULTIROW ? argCount : 1); - } - private class JavaDriverRun extends Runner { final JavaDriverClient client;