cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r888551 - in /incubator/cassandra/trunk/src/java/org/apache/cassandra: dht/Range.java service/AntiEntropyService.java service/StorageProxy.java utils/MerkleTree.java
Date Tue, 08 Dec 2009 19:54:09 GMT
Author: jbellis
Date: Tue Dec  8 19:54:09 2009
New Revision: 888551

URL: http://svn.apache.org/viewvc?rev=888551&view=rev
Log:
r/m unused code.  patch by Stu Hood; reviewed by jbellis for CASSANDRA-608

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/Range.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/AntiEntropyService.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/MerkleTree.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/Range.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/Range.java?rev=888551&r1=888550&r2=888551&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/Range.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/Range.java Tue Dec  8 19:54:09
2009
@@ -34,6 +34,8 @@
  */
 public class Range implements Comparable<Range>, Serializable
 {
+    public static final long serialVersionUID = 1L;
+    
     private static ICompactSerializer<Range> serializer_;
     static
     {

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/AntiEntropyService.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/AntiEntropyService.java?rev=888551&r1=888550&r2=888551&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/AntiEntropyService.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/AntiEntropyService.java
Tue Dec  8 19:54:09 2009
@@ -557,7 +557,6 @@
         public void run()
         {
             StorageService ss = StorageService.instance();
-            Token minimum = ss.getPartitioner().getMinimumToken();
 
             // restore partitioners (in case we were serialized)
             if (ltree.partitioner() == null)

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java?rev=888551&r1=888550&r2=888551&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java Tue
Dec  8 19:54:09 2009
@@ -548,7 +548,6 @@
                 throw new UnavailableException();
 
             // to make comparing the results from each node easy, we restrict each command
to the data in the primary range for this iteration
-            IPartitioner<?> p = StorageService.getPartitioner();
             DecoratedKey startKey;
             DecoratedKey finishKey;
             if (primaryRange.left().equals(primaryRange.right()))
@@ -560,8 +559,8 @@
             {
                 startKey = Collections.max(Arrays.asList(command.startKey, new DecoratedKey(primaryRange.left(),
null)));
                 finishKey = command.finishKey.isEmpty()
-                                       ? new DecoratedKey(primaryRange.right(), null)
-                                       : Collections.min(Arrays.asList(command.finishKey,
new DecoratedKey(primaryRange.right(), null)));
+                          ? new DecoratedKey(primaryRange.right(), null)
+                          : Collections.min(Arrays.asList(command.finishKey, new DecoratedKey(primaryRange.right(),
null)));
             }
             RangeSliceCommand c2 = new RangeSliceCommand(command.keyspace, command.column_family,
command.super_column, command.predicate, startKey, finishKey, command.max_keys);
             Message message = c2.getMessage();

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/MerkleTree.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/MerkleTree.java?rev=888551&r1=888550&r2=888551&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/MerkleTree.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/MerkleTree.java Tue Dec
 8 19:54:09 2009
@@ -20,7 +20,6 @@
 
 import java.io.Serializable;
 import java.util.*;
-import java.math.BigInteger;
 
 import com.google.common.collect.AbstractIterator;
 import com.google.common.collect.Iterators;
@@ -165,7 +164,6 @@
     /**
      * @param ltree First tree.
      * @param rtree Second tree.
-     * @param active Only ranges that intersect this range will be returned.
      * @return A list of the largest contiguous ranges where the given trees disagree.
      */
     public static List<TreeRange> difference(MerkleTree ltree, MerkleTree rtree)
@@ -273,11 +271,10 @@
      */
     public void invalidate(Token t)
     {
-        Token mintoken = partitioner.getMinimumToken();
-        invalidateHelper(root, mintoken, mintoken, (byte)0, t);
+        invalidateHelper(root, partitioner.getMinimumToken(), t);
     }
 
-    public void invalidateHelper(Hashable hashable, Token pleft, Token pright, byte depth,
Token t)
+    private void invalidateHelper(Hashable hashable, Token pleft, Token t)
     {
         hashable.hash(null);
         if (hashable instanceof Leaf)
@@ -287,10 +284,10 @@
         Inner node = (Inner)hashable;
         if (Range.contains(pleft, node.token, t))
             // left child contains token
-            invalidateHelper(node.lchild, pleft, node.token, inc(depth), t);
+            invalidateHelper(node.lchild, pleft, t);
         else
             // right child contains token
-            invalidateHelper(node.rchild, node.token, pright, inc(depth), t);
+            invalidateHelper(node.rchild, node.token, t);
     }
 
     /**
@@ -319,7 +316,7 @@
     /**
      * @throws StopRecursion If no match could be found for the range.
      */
-    byte[] hashHelper(Hashable hashable, Range active, Range range) throws StopRecursion
+    private byte[] hashHelper(Hashable hashable, Range active, Range range) throws StopRecursion
     {
         if (hashable instanceof Leaf)
         {
@@ -382,7 +379,7 @@
         return true;
     }
 
-    Hashable splitHelper(Hashable hashable, Token pleft, Token pright, byte depth, Token
t) throws StopRecursion.TooDeep
+    private Hashable splitHelper(Hashable hashable, Token pleft, Token pright, byte depth,
Token t) throws StopRecursion.TooDeep
     {
         if (depth >= hashdepth)
             throw new StopRecursion.TooDeep();
@@ -415,11 +412,10 @@
      */
     public void compact(Token t)
     {
-        Token mintoken = partitioner.getMinimumToken();
-        root = compactHelper(root, mintoken, mintoken, t);
+        root = compactHelper(root, t);
     }
 
-    Hashable compactHelper(Hashable hashable, Token pleft, Token pright, Token t)
+    private Hashable compactHelper(Hashable hashable, Token t)
     {
         // we reached a Leaf without finding an Inner to compact
         assert !(hashable instanceof Leaf);
@@ -438,10 +434,10 @@
         }
         else if (comp < 0)
             // recurse to the left
-            node.lchild(compactHelper(node.lchild(), pleft, node.token, t));
+            node.lchild(compactHelper(node.lchild(), t));
         else
             // recurse to the right
-            node.rchild(compactHelper(node.rchild(), node.token, pright, t));
+            node.rchild(compactHelper(node.rchild(), t));
         return node;
     }
 
@@ -476,6 +472,7 @@
      */
     public static class TreeRange extends Range
     {
+        public static final long serialVersionUID = 1L;
         private final MerkleTree tree;
         public final byte depth;
         public final Hashable hashable;
@@ -563,7 +560,7 @@
                 }
 
                 // hash relevant values from the iterator, and add to the context
-                return consume(left, right, depth, entries);
+                return consume(left, right, entries);
             }
             else
             {
@@ -577,7 +574,7 @@
          * Consumes and sequentially hashes values from the iterator that fall into the active
          * range. Should be called with an iterator that contains at least one matching entry.
          */
-        private byte[] consume(Token left, Token right, byte depth, PeekingIterator<RowHash>
entries)
+        private byte[] consume(Token left, Token right, PeekingIterator<RowHash> entries)
         {
             byte[] sequentialHash = entries.next().hash;
             while (entries.hasNext() && Range.contains(left, right, entries.peek().token))
@@ -661,6 +658,7 @@
      */
     static class Inner extends Hashable
     {
+        public static final long serialVersionUID = 1L;
         public final Token token;
         private Hashable lchild;
         private Hashable rchild;
@@ -745,6 +743,7 @@
      */
     static class Leaf extends Hashable
     {
+        public static final long serialVersionUID = 1L;
         /**
          * Constructs a null hash.
          */



Mime
View raw message