cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject [1/3] cassandra git commit: better validator randomness patch by dbrosius, reviewed by rstupp for CASSANDRA-10917
Date Thu, 24 Dec 2015 00:12:18 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk ce6ad5bf8 -> 02c92dfce


better validator randomness
patch by dbrosius, reviewed by rstupp for CASSANDRA-10917


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/867fd8e2
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/867fd8e2
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/867fd8e2

Branch: refs/heads/trunk
Commit: 867fd8e2e9c33e8f2ee1d13c3b7dd177434ec645
Parents: 382d9a9
Author: Dave Brosius <dbrosius@mebigfatguy.com>
Authored: Wed Dec 23 19:04:32 2015 -0500
Committer: Dave Brosius <dbrosius@mebigfatguy.com>
Committed: Wed Dec 23 19:04:32 2015 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/repair/Validator.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/867fd8e2/src/java/org/apache/cassandra/repair/Validator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/repair/Validator.java b/src/java/org/apache/cassandra/repair/Validator.java
index d206305..3db9761 100644
--- a/src/java/org/apache/cassandra/repair/Validator.java
+++ b/src/java/org/apache/cassandra/repair/Validator.java
@@ -90,9 +90,11 @@ public class Validator implements Runnable
         }
         else
         {
+            List<DecoratedKey> keys = new ArrayList<>();
+            Random random = new Random();
+            
             for (Range<Token> range : tree.ranges())
             {
-                List<DecoratedKey> keys = new ArrayList<>();
                 for (DecoratedKey sample : cfs.keySamples(range))
                 {
                     assert range.contains(sample.getToken()) : "Token " + sample.getToken()
+ " is not within range " + desc.ranges;
@@ -107,7 +109,6 @@ public class Validator implements Runnable
                 else
                 {
                     int numKeys = keys.size();
-                    Random random = new Random();
                     // sample the column family using random keys from the index
                     while (true)
                     {
@@ -115,6 +116,7 @@ public class Validator implements Runnable
                         if (!tree.split(dk.getToken()))
                             break;
                     }
+                    keys.clear();
                 }
             }
         }


Mime
View raw message