Repository: cassandra Updated Branches: refs/heads/trunk 0b5088798 -> 1c3a2d247
Fix some alerts raised by static analysis (lgtm.com) Patch by Malcolm Taylor; Reviewed by Jeff Jirsa for CASSANDRA-13799 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/1c3a2d24 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/1c3a2d24 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/1c3a2d24 Branch: refs/heads/trunk Commit: 1c3a2d247a31eceef8893be7249119604a9c1b96 Parents: 0b50887 Author: Malcolm Taylor <malc...@semmle.com> Authored: Wed Aug 30 09:29:00 2017 +0100 Committer: Jeff Jirsa <jji...@apple.com> Committed: Fri Oct 20 16:44:22 2017 -0700 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../apache/cassandra/cql3/FieldIdentifier.java | 2 +- .../org/apache/cassandra/cql3/RoleName.java | 2 +- .../cql3/conditions/ColumnCondition.java | 2 +- .../cql3/functions/FunctionResolver.java | 2 +- .../cassandra/index/sasi/plan/Expression.java | 8 +++ .../io/compress/CompressionMetadata.java | 14 +++--- .../apache/cassandra/locator/TokenMetadata.java | 16 +++--- .../cql3/functions/OperationFctsTest.java | 10 ++-- .../operations/InsertUpdateIfConditionTest.java | 32 ++++++------ .../index/sasi/plan/ExpressionTest.java | 53 ++++++++++++++++++++ .../cassandra/stress/generate/Distribution.java | 8 +-- .../cassandra/stress/generate/SeedManager.java | 10 ++-- .../stress/generate/values/Booleans.java | 2 +- 14 files changed, 112 insertions(+), 50 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/1c3a2d24/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 6d84bc8..b2d6085 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,6 @@ 4.0 * Add nodetool cmd to print hinted handoff window (CASSANDRA-13728) + * Fix some alerts raised by static analysis (CASSANDRA-13799) * Checksum sstable metadata (CASSANDRA-13321, CASSANDRA-13593) * Add result set metadata to prepared statement MD5 hash calculation (CASSANDRA-10786) * Refactor GcCompactionTest to avoid boxing (CASSANDRA-13941) http://git-wip-us.apache.org/repos/asf/cassandra/blob/1c3a2d24/src/java/org/apache/cassandra/cql3/FieldIdentifier.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/cql3/FieldIdentifier.java b/src/java/org/apache/cassandra/cql3/FieldIdentifier.java index 9f72fc4..bdde98d 100644 --- a/src/java/org/apache/cassandra/cql3/FieldIdentifier.java +++ b/src/java/org/apache/cassandra/cql3/FieldIdentifier.java @@ -41,7 +41,7 @@ public class FieldIdentifier */ public static FieldIdentifier forUnquoted(String text) { - return new FieldIdentifier(convert(text.toLowerCase(Locale.US))); + return new FieldIdentifier(convert(text == null ? null : text.toLowerCase(Locale.US))); } /** http://git-wip-us.apache.org/repos/asf/cassandra/blob/1c3a2d24/src/java/org/apache/cassandra/cql3/RoleName.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/cql3/RoleName.java b/src/java/org/apache/cassandra/cql3/RoleName.java index ce81fa9..b50c17d 100644 --- a/src/java/org/apache/cassandra/cql3/RoleName.java +++ b/src/java/org/apache/cassandra/cql3/RoleName.java @@ -25,7 +25,7 @@ public class RoleName public void setName(String name, boolean keepCase) { - this.name = keepCase ? name : name.toLowerCase(Locale.US); + this.name = keepCase ? name : (name == null ? name : name.toLowerCase(Locale.US)); } public boolean hasName() http://git-wip-us.apache.org/repos/asf/cassandra/blob/1c3a2d24/src/java/org/apache/cassandra/cql3/conditions/ColumnCondition.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/cql3/conditions/ColumnCondition.java b/src/java/org/apache/cassandra/cql3/conditions/ColumnCondition.java index 24a8674..f3e0ee2 100644 --- a/src/java/org/apache/cassandra/cql3/conditions/ColumnCondition.java +++ b/src/java/org/apache/cassandra/cql3/conditions/ColumnCondition.java @@ -832,7 +832,7 @@ public abstract class ColumnCondition checkFalse(type.isCollection(), "Slice conditions are not supported on collections containing durations"); checkFalse(type.isTuple(), "Slice conditions are not supported on tuples containing durations"); checkFalse(type.isUDT(), "Slice conditions are not supported on UDTs containing durations"); - throw invalidRequest("Slice conditions are not supported on durations", operator); + throw invalidRequest("Slice conditions ( %s ) are not supported on durations", operator); } } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/1c3a2d24/src/java/org/apache/cassandra/cql3/functions/FunctionResolver.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/cql3/functions/FunctionResolver.java b/src/java/org/apache/cassandra/cql3/functions/FunctionResolver.java index 9c7e85f..99c0fca 100644 --- a/src/java/org/apache/cassandra/cql3/functions/FunctionResolver.java +++ b/src/java/org/apache/cassandra/cql3/functions/FunctionResolver.java @@ -156,7 +156,7 @@ public final class FunctionResolver return toTest; } } - throw invalidRequest("Ambiguous '%s' operation: use type casts to disambiguate", + throw invalidRequest("Ambiguous '%s' operation with args %s and %s: use type casts to disambiguate", OperationFcts.getOperator(name), providedArgs.get(0), providedArgs.get(1)); } http://git-wip-us.apache.org/repos/asf/cassandra/blob/1c3a2d24/src/java/org/apache/cassandra/index/sasi/plan/Expression.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/index/sasi/plan/Expression.java b/src/java/org/apache/cassandra/index/sasi/plan/Expression.java index 4f9d6b0..54a4e0e 100644 --- a/src/java/org/apache/cassandra/index/sasi/plan/Expression.java +++ b/src/java/org/apache/cassandra/index/sasi/plan/Expression.java @@ -411,5 +411,13 @@ public class Expression Bound o = (Bound) other; return value.equals(o.value) && inclusive == o.inclusive; } + + public int hashCode() + { + HashCodeBuilder builder = new HashCodeBuilder(); + builder.append(value); + builder.append(inclusive); + return builder.toHashCode(); + } } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/1c3a2d24/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java b/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java index 8ac6589..391baee 100644 --- a/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java +++ b/src/java/org/apache/cassandra/io/compress/CompressionMetadata.java @@ -424,19 +424,19 @@ public class CompressionMetadata @SuppressWarnings("resource") public CompressionMetadata open(long dataLength, long compressedLength) { - SafeMemory offsets = this.offsets.sharedCopy(); + SafeMemory tOffsets = this.offsets.sharedCopy(); // calculate how many entries we need, if our dataLength is truncated - int count = (int) (dataLength / parameters.chunkLength()); + int tCount = (int) (dataLength / parameters.chunkLength()); if (dataLength % parameters.chunkLength() != 0) - count++; + tCount++; - assert count > 0; + assert tCount > 0; // grab our actual compressed length from the next offset from our the position we're opened to - if (count < this.count) - compressedLength = offsets.getLong(count * 8L); + if (tCount < this.count) + compressedLength = tOffsets.getLong(tCount * 8L); - return new CompressionMetadata(filePath, parameters, offsets, count * 8L, dataLength, compressedLength); + return new CompressionMetadata(filePath, parameters, tOffsets, tCount * 8L, dataLength, compressedLength); } /** http://git-wip-us.apache.org/repos/asf/cassandra/blob/1c3a2d24/src/java/org/apache/cassandra/locator/TokenMetadata.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/locator/TokenMetadata.java b/src/java/org/apache/cassandra/locator/TokenMetadata.java index 50d9744..00f9536 100644 --- a/src/java/org/apache/cassandra/locator/TokenMetadata.java +++ b/src/java/org/apache/cassandra/locator/TokenMetadata.java @@ -824,17 +824,17 @@ public class TokenMetadata long startedAt = System.currentTimeMillis(); // create clone of current state - BiMultiValMap<Token, InetAddress> bootstrapTokens = new BiMultiValMap<>(); - Set<InetAddress> leavingEndpoints = new HashSet<>(); - Set<Pair<Token, InetAddress>> movingEndpoints = new HashSet<>(); + BiMultiValMap<Token, InetAddress> bootstrapTokensClone = new BiMultiValMap<>(); + Set<InetAddress> leavingEndpointsClone = new HashSet<>(); + Set<Pair<Token, InetAddress>> movingEndpointsClone = new HashSet<>(); TokenMetadata metadata; lock.readLock().lock(); try { - bootstrapTokens.putAll(this.bootstrapTokens); - leavingEndpoints.addAll(this.leavingEndpoints); - movingEndpoints.addAll(this.movingEndpoints); + bootstrapTokensClone.putAll(this.bootstrapTokens); + leavingEndpointsClone.addAll(this.leavingEndpoints); + movingEndpointsClone.addAll(this.movingEndpoints); metadata = this.cloneOnlyTokenMap(); } finally @@ -842,8 +842,8 @@ public class TokenMetadata lock.readLock().unlock(); } - pendingRanges.put(keyspaceName, calculatePendingRanges(strategy, metadata, bootstrapTokens, - leavingEndpoints, movingEndpoints)); + pendingRanges.put(keyspaceName, calculatePendingRanges(strategy, metadata, bootstrapTokensClone, + leavingEndpointsClone, movingEndpointsClone)); long took = System.currentTimeMillis() - startedAt; if (logger.isDebugEnabled()) http://git-wip-us.apache.org/repos/asf/cassandra/blob/1c3a2d24/test/unit/org/apache/cassandra/cql3/functions/OperationFctsTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/cql3/functions/OperationFctsTest.java b/test/unit/org/apache/cassandra/cql3/functions/OperationFctsTest.java index 49c9e30..d27b746 100644 --- a/test/unit/org/apache/cassandra/cql3/functions/OperationFctsTest.java +++ b/test/unit/org/apache/cassandra/cql3/functions/OperationFctsTest.java @@ -292,17 +292,17 @@ public class OperationFctsTest extends CQLTester row(2, (byte) 2, (short) 2, "test")); // tinyint, smallint and int could be used there so we need to disambiguate - assertInvalidMessage("Ambiguous '+' operation: use type casts to disambiguate", + assertInvalidMessage("Ambiguous '+' operation with args ? and 1: use type casts to disambiguate", "SELECT * FROM %s WHERE pk = ? + 1 AND c1 = 2", 1); - assertInvalidMessage("Ambiguous '+' operation: use type casts to disambiguate", + assertInvalidMessage("Ambiguous '+' operation with args ? and 1: use type casts to disambiguate", "SELECT * FROM %s WHERE pk = 2 AND c1 = 2 AND c2 = 1 * (? + 1)", 1); assertRows(execute("SELECT 1 + 1, v FROM %s WHERE pk = 2 AND c1 = 2"), row(2, "test")); // As the output type is unknown the ? type cannot be determined - assertInvalidMessage("Ambiguous '+' operation: use type casts to disambiguate", + assertInvalidMessage("Ambiguous '+' operation with args 1 and ?: use type casts to disambiguate", "SELECT 1 + ?, v FROM %s WHERE pk = 2 AND c1 = 2", 1); // As the prefered type for the constants is int, the returned type will be int @@ -310,7 +310,7 @@ public class OperationFctsTest extends CQLTester row(150, "test")); // As the output type is unknown the ? type cannot be determined - assertInvalidMessage("Ambiguous '+' operation: use type casts to disambiguate", + assertInvalidMessage("Ambiguous '+' operation with args ? and 50: use type casts to disambiguate", "SELECT ? + 50, v FROM %s WHERE pk = 2 AND c1 = 2", 100); createTable("CREATE TABLE %s (a tinyint, b smallint, c int, d bigint, e float, f double, g varint, h decimal, PRIMARY KEY(a, b))" @@ -672,7 +672,7 @@ public class OperationFctsTest extends CQLTester public void testWithNanAndInfinity() throws Throwable { createTable("CREATE TABLE %s (a int PRIMARY KEY, b double, c decimal)"); - assertInvalidMessage("Ambiguous '+' operation: use type casts to disambiguate", + assertInvalidMessage("Ambiguous '+' operation with args ? and 1: use type casts to disambiguate", "INSERT INTO %S (a, b, c) VALUES (? + 1, ?, ?)", 0, Double.NaN, BigDecimal.valueOf(1)); execute("INSERT INTO %S (a, b, c) VALUES ((int) ? + 1, -?, ?)", 0, Double.NaN, BigDecimal.valueOf(1)); http://git-wip-us.apache.org/repos/asf/cassandra/blob/1c3a2d24/test/unit/org/apache/cassandra/cql3/validation/operations/InsertUpdateIfConditionTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/cql3/validation/operations/InsertUpdateIfConditionTest.java b/test/unit/org/apache/cassandra/cql3/validation/operations/InsertUpdateIfConditionTest.java index da5c3bd..a0ae214 100644 --- a/test/unit/org/apache/cassandra/cql3/validation/operations/InsertUpdateIfConditionTest.java +++ b/test/unit/org/apache/cassandra/cql3/validation/operations/InsertUpdateIfConditionTest.java @@ -2038,13 +2038,13 @@ public class InsertUpdateIfConditionTest extends CQLTester { createTable(" CREATE TABLE %s (k int PRIMARY KEY, v int, d duration)"); - assertInvalidMessage("Slice conditions are not supported on durations", + assertInvalidMessage("Slice conditions ( > ) are not supported on durations", "UPDATE %s SET v = 3 WHERE k = 0 IF d > 1s"); - assertInvalidMessage("Slice conditions are not supported on durations", + assertInvalidMessage("Slice conditions ( >= ) are not supported on durations", "UPDATE %s SET v = 3 WHERE k = 0 IF d >= 1s"); - assertInvalidMessage("Slice conditions are not supported on durations", + assertInvalidMessage("Slice conditions ( <= ) are not supported on durations", "UPDATE %s SET v = 3 WHERE k = 0 IF d <= 1s"); - assertInvalidMessage("Slice conditions are not supported on durations", + assertInvalidMessage("Slice conditions ( < ) are not supported on durations", "UPDATE %s SET v = 3 WHERE k = 0 IF d < 1s"); execute("INSERT INTO %s (k, v, d) VALUES (1, 1, 2s)"); @@ -2100,13 +2100,13 @@ public class InsertUpdateIfConditionTest extends CQLTester assertRows(execute("SELECT * FROM %s WHERE k = 1"), row(1, list(Duration.from("5s"), Duration.from("10s")), 6)); - assertInvalidMessage("Slice conditions are not supported on durations", + assertInvalidMessage("Slice conditions ( > ) are not supported on durations", "UPDATE %s SET v = 3 WHERE k = 0 IF l[0] > 1s"); - assertInvalidMessage("Slice conditions are not supported on durations", + assertInvalidMessage("Slice conditions ( >= ) are not supported on durations", "UPDATE %s SET v = 3 WHERE k = 0 IF l[0] >= 1s"); - assertInvalidMessage("Slice conditions are not supported on durations", + assertInvalidMessage("Slice conditions ( <= ) are not supported on durations", "UPDATE %s SET v = 3 WHERE k = 0 IF l[0] <= 1s"); - assertInvalidMessage("Slice conditions are not supported on durations", + assertInvalidMessage("Slice conditions ( < ) are not supported on durations", "UPDATE %s SET v = 3 WHERE k = 0 IF l[0] < 1s"); assertRows(execute("UPDATE %s SET v = 4 WHERE k = 1 IF l[0] = 2s"), row(false, list(Duration.from("5s"), Duration.from("10s")))); @@ -2218,13 +2218,13 @@ public class InsertUpdateIfConditionTest extends CQLTester assertRows(execute("SELECT * FROM %s WHERE k = 1"), row(1, map(1, Duration.from("5s"), 2, Duration.from("10s")), 6)); - assertInvalidMessage("Slice conditions are not supported on durations", + assertInvalidMessage("Slice conditions ( > ) are not supported on durations", "UPDATE %s SET v = 3 WHERE k = 0 IF m[1] > 1s"); - assertInvalidMessage("Slice conditions are not supported on durations", + assertInvalidMessage("Slice conditions ( >= ) are not supported on durations", "UPDATE %s SET v = 3 WHERE k = 0 IF m[1] >= 1s"); - assertInvalidMessage("Slice conditions are not supported on durations", + assertInvalidMessage("Slice conditions ( <= ) are not supported on durations", "UPDATE %s SET v = 3 WHERE k = 0 IF m[1] <= 1s"); - assertInvalidMessage("Slice conditions are not supported on durations", + assertInvalidMessage("Slice conditions ( < ) are not supported on durations", "UPDATE %s SET v = 3 WHERE k = 0 IF m[1] < 1s"); assertRows(execute("UPDATE %s SET v = 4 WHERE k = 1 IF m[1] = 2s"), row(false, map(1, Duration.from("5s"), 2, Duration.from("10s")))); @@ -2338,13 +2338,13 @@ public class InsertUpdateIfConditionTest extends CQLTester assertRows(execute("SELECT * FROM %s WHERE k = 1"), row(1, userType("i", 1, "d", Duration.from("10s")), 6)); - assertInvalidMessage("Slice conditions are not supported on durations", + assertInvalidMessage("Slice conditions ( > ) are not supported on durations", "UPDATE %s SET v = 3 WHERE k = 0 IF u.d > 1s"); - assertInvalidMessage("Slice conditions are not supported on durations", + assertInvalidMessage("Slice conditions ( >= ) are not supported on durations", "UPDATE %s SET v = 3 WHERE k = 0 IF u.d >= 1s"); - assertInvalidMessage("Slice conditions are not supported on durations", + assertInvalidMessage("Slice conditions ( <= ) are not supported on durations", "UPDATE %s SET v = 3 WHERE k = 0 IF u.d <= 1s"); - assertInvalidMessage("Slice conditions are not supported on durations", + assertInvalidMessage("Slice conditions ( < ) are not supported on durations", "UPDATE %s SET v = 3 WHERE k = 0 IF u.d < 1s"); assertRows(execute("UPDATE %s SET v = 4 WHERE k = 1 IF u.d = 2s"), row(false, userType("i", 1, "d", Duration.from("10s")))); http://git-wip-us.apache.org/repos/asf/cassandra/blob/1c3a2d24/test/unit/org/apache/cassandra/index/sasi/plan/ExpressionTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/index/sasi/plan/ExpressionTest.java b/test/unit/org/apache/cassandra/index/sasi/plan/ExpressionTest.java new file mode 100644 index 0000000..7457a85 --- /dev/null +++ b/test/unit/org/apache/cassandra/index/sasi/plan/ExpressionTest.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.cassandra.index.sasi.plan; + +import java.nio.ByteBuffer; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import org.junit.Test; + +import org.apache.cassandra.db.marshal.UTF8Type; +import org.apache.cassandra.index.sasi.plan.Expression.Bound; + +public class ExpressionTest +{ + + @Test + public void testBoundHashCode() + { + ByteBuffer buf1 = UTF8Type.instance.decompose("blah"); + Expression.Bound b1 = new Expression.Bound(buf1, true); + ByteBuffer buf2 = UTF8Type.instance.decompose("blah"); + Expression.Bound b2 = new Expression.Bound(buf2, true); + assertTrue(b1.equals(b2)); + assertTrue(b1.hashCode() == b2.hashCode()); + } + + @Test + public void testNotMatchingBoundHashCode() + { + ByteBuffer buf1 = UTF8Type.instance.decompose("blah"); + Expression.Bound b1 = new Expression.Bound(buf1, true); + ByteBuffer buf2 = UTF8Type.instance.decompose("blah2"); + Expression.Bound b2 = new Expression.Bound(buf2, true); + assertFalse(b1.equals(b2)); + assertFalse(b1.hashCode() == b2.hashCode()); + } +} http://git-wip-us.apache.org/repos/asf/cassandra/blob/1c3a2d24/tools/stress/src/org/apache/cassandra/stress/generate/Distribution.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/stress/generate/Distribution.java b/tools/stress/src/org/apache/cassandra/stress/generate/Distribution.java index 4662454..0100006 100644 --- a/tools/stress/src/org/apache/cassandra/stress/generate/Distribution.java +++ b/tools/stress/src/org/apache/cassandra/stress/generate/Distribution.java @@ -45,13 +45,13 @@ public abstract class Distribution implements Serializable public long average() { double sum = 0; - int count = 0; - for (float d = 0 ; d <= 1.0d ; d += 0.02d) + double d = 0d; + for (int count = 0; count < 51 ; count++) { sum += inverseCumProb(d); - count += 1; + d += 0.02d; } - return (long) (sum / count); + return (long) (sum / 51); } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/1c3a2d24/tools/stress/src/org/apache/cassandra/stress/generate/SeedManager.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/stress/generate/SeedManager.java b/tools/stress/src/org/apache/cassandra/stress/generate/SeedManager.java index ae442e7..4eeb47d 100644 --- a/tools/stress/src/org/apache/cassandra/stress/generate/SeedManager.java +++ b/tools/stress/src/org/apache/cassandra/stress/generate/SeedManager.java @@ -43,9 +43,9 @@ public class SeedManager public SeedManager(StressSettings settings) { - Distribution sample = settings.insert.revisit.get(); - this.sampleOffset = Math.min(sample.minValue(), sample.maxValue()); - long sampleSize = 1 + Math.max(sample.minValue(), sample.maxValue()) - sampleOffset; + Distribution tSample = settings.insert.revisit.get(); + this.sampleOffset = Math.min(tSample.minValue(), tSample.maxValue()); + long sampleSize = 1 + Math.max(tSample.minValue(), tSample.maxValue()) - sampleOffset; if (sampleOffset < 0 || sampleSize > Integer.MAX_VALUE) throw new IllegalArgumentException("sample range is invalid"); @@ -76,7 +76,7 @@ public class SeedManager this.writes = writes; this.reads = reads; this.sampleFrom = new LockedDynamicList<>((int) sampleSize); - this.sample = DistributionInverted.invert(sample); + this.sample = DistributionInverted.invert(tSample); this.sampleSize = (int) sampleSize; this.updateSampleImmediately = visits.average() > 1; } @@ -88,7 +88,7 @@ public class SeedManager Seed seed = reads.next(-1); if (seed == null) return null; - Seed managing = this.managing.get(seed); + Seed managing = this.managing.get(seed.seed); return managing == null ? seed : managing; } http://git-wip-us.apache.org/repos/asf/cassandra/blob/1c3a2d24/tools/stress/src/org/apache/cassandra/stress/generate/values/Booleans.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/stress/generate/values/Booleans.java b/tools/stress/src/org/apache/cassandra/stress/generate/values/Booleans.java index 21525af..9ecacbb 100644 --- a/tools/stress/src/org/apache/cassandra/stress/generate/values/Booleans.java +++ b/tools/stress/src/org/apache/cassandra/stress/generate/values/Booleans.java @@ -32,6 +32,6 @@ public class Booleans extends Generator<Boolean> @Override public Boolean generate() { - return identityDistribution.next() % 1 == 0; + return identityDistribution.next() % 2 == 0; } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org