You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by be...@apache.org on 2015/03/24 14:43:07 UTC
[2/3] cassandra git commit: permit n=1 in cassandra-stress
permit n=1 in cassandra-stress
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6b979f31
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6b979f31
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6b979f31
Branch: refs/heads/trunk
Commit: 6b979f31912e2e823bc22511dc3a5746d05f276e
Parents: 4eef449
Author: Benedict Elliott Smith <be...@apache.org>
Authored: Tue Mar 24 13:42:48 2015 +0000
Committer: Benedict Elliott Smith <be...@apache.org>
Committed: Tue Mar 24 13:42:48 2015 +0000
----------------------------------------------------------------------
.../cassandra/stress/settings/OptionDistribution.java | 10 ++++++++++
1 file changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/6b979f31/tools/stress/src/org/apache/cassandra/stress/settings/OptionDistribution.java
----------------------------------------------------------------------
diff --git a/tools/stress/src/org/apache/cassandra/stress/settings/OptionDistribution.java b/tools/stress/src/org/apache/cassandra/stress/settings/OptionDistribution.java
index 7186efb..713f5a6 100644
--- a/tools/stress/src/org/apache/cassandra/stress/settings/OptionDistribution.java
+++ b/tools/stress/src/org/apache/cassandra/stress/settings/OptionDistribution.java
@@ -213,6 +213,8 @@ public class OptionDistribution extends Option
mean = (min + max) / 2d;
stdev = ((max - min) / 2d) / stdevsToEdge;
}
+ if (min == max)
+ return new FixedFactory(min);
return new GaussianFactory(min, max, mean, stdev);
} catch (Exception ignore)
{
@@ -233,6 +235,8 @@ public class OptionDistribution extends Option
String[] bounds = params.get(0).split("\\.\\.+");
final long min = parseLong(bounds[0]);
final long max = parseLong(bounds[1]);
+ if (min == max)
+ return new FixedFactory(min);
ExponentialDistribution findBounds = new ExponentialDistribution(1d);
// max probability should be roughly equal to accuracy of (max-min) to ensure all values are visitable,
// over entire range, but this results in overly skewed distribution, so take sqrt
@@ -257,6 +261,8 @@ public class OptionDistribution extends Option
String[] bounds = params.get(0).split("\\.\\.+");
final long min = parseLong(bounds[0]);
final long max = parseLong(bounds[1]);
+ if (min == max)
+ return new FixedFactory(min);
final double shape = Double.parseDouble(params.get(1));
WeibullDistribution findBounds = new WeibullDistribution(shape, 1d);
// max probability should be roughly equal to accuracy of (max-min) to ensure all values are visitable,
@@ -288,6 +294,8 @@ public class OptionDistribution extends Option
// max probability should be roughly equal to accuracy of (max-min) to ensure all values are visitable,
// over entire range, but this results in overly skewed distribution, so take sqrt
final double scale = (max - min) / findBounds.inverseCumulativeProbability(1d - Math.sqrt(1d/(max-min)));
+ if (min == max)
+ return new FixedFactory(min);
return new QuantizedExtremeFactory(min, max, shape, scale, quantas);
} catch (Exception ignore)
{
@@ -309,6 +317,8 @@ public class OptionDistribution extends Option
String[] bounds = params.get(0).split("\\.\\.+");
final long min = parseLong(bounds[0]);
final long max = parseLong(bounds[1]);
+ if (min == max)
+ return new FixedFactory(min);
return new UniformFactory(min, max);
} catch (Exception ignore)
{