Updated Branches:
  refs/heads/trunk be2726b39 -> f70339682

more comment update


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

Branch: refs/heads/trunk
Commit: f70339682524026a3955bf56ac7a0d4f4f1e1114
Parents: be2726b
Author: Yuki Morishita <yu...@apache.org>
Authored: Thu Mar 28 23:28:05 2013 -0500
Committer: Yuki Morishita <yu...@apache.org>
Committed: Thu Mar 28 23:29:06 2013 -0500

----------------------------------------------------------------------
 .../cassandra/service/ActiveRepairService.java     |   54 +++++----------
 1 files changed, 18 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f7033968/src/java/org/apache/cassandra/service/ActiveRepairService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/ActiveRepairService.java 
b/src/java/org/apache/cassandra/service/ActiveRepairService.java
index 3c5ba7f..f103771 100644
--- a/src/java/org/apache/cassandra/service/ActiveRepairService.java
+++ b/src/java/org/apache/cassandra/service/ActiveRepairService.java
@@ -51,34 +51,30 @@ import org.apache.cassandra.utils.*;
 
 /**
  * ActiveRepairService encapsulates "validating" (hashing) individual column 
families,
- * exchanging MerkleTrees with remote nodes via a TreeRequest/Response 
conversation,
+ * exchanging MerkleTrees with remote nodes via a tree request/response 
conversation,
  * and then triggering repairs for disagreeing ranges.
  *
  * The node where repair was invoked acts as the 'initiator,' where valid 
trees are sent after generation
- * and where the local and remote tree will rendezvous in rendezvous(cf, 
endpoint, tree).
+ * and where the local and remote tree will rendezvous in rendezvous().
  * Once the trees rendezvous, a Differencer is executed and the service can 
trigger repairs
  * for disagreeing ranges.
  *
- * Tree comparison and repair triggering occur in the single threaded 
Stage.ANTIENTROPY.
+ * Tree comparison and repair triggering occur in the single threaded 
Stage.ANTI_ENTROPY.
  *
  * The steps taken to enact a repair are as follows:
- * 1. A repair is requested via nodeprobe:
+ * 1. A repair is requested via JMX/nodetool:
  *   * The initiator sends TreeRequest messages to all neighbors of the target 
node: when a node
  *     receives a TreeRequest, it will perform a validation (read-only) 
compaction to immediately validate
  *     the column family.  This is performed on the CompactionManager 
ExecutorService.
  * 2. The validation process builds the merkle tree by:
  *   * Calling Validator.prepare(), which samples the column family to 
determine key distribution,
- *   * Calling Validator.add() in order for every row in the column family,
+ *   * Calling Validator.add() in order for rows in repair range in the column 
family,
  *   * Calling Validator.complete() to indicate that all rows have been added.
  *     * Calling complete() indicates that a valid MerkleTree has been created 
for the column family.
  *     * The valid tree is returned to the requesting node via a TreeResponse.
- * 3. When a node receives a TreeResponse, it passes the tree to rendezvous(), 
which checks for trees to
- *    rendezvous with / compare to:
- *   * If the tree is local, it is cached, and compared to any trees that were 
received from neighbors.
- *   * If the tree is remote, it is immediately compared to a local tree if 
one is cached. Otherwise,
- *     the remote tree is stored until a local tree can be generated.
- *   * A Differencer object is enqueued for each comparison.
- * 4. Differencers are executed in Stage.ANTIENTROPY, to compare the two 
trees, and perform repair via the
+ * 3. When a node receives a tree response, it passes the tree to rendezvous() 
to see if all responses are
+ *    received. Once the initiator receives all responses, it creates 
Differencers on every tree pair combination.
+ * 4. Differencers are executed in Stage.ANTI_ENTROPY, to compare the given 
two trees, and perform repair via the
  *    streaming api.
  */
 public class ActiveRepairService
@@ -110,7 +106,7 @@ public class ActiveRepairService
     private final ConcurrentMap<String, RepairSession> sessions;
 
     /**
-     * Protected constructor. Use AntiEntropyService.instance.
+     * Protected constructor. Use ActiveRepairService.instance.
      */
     protected ActiveRepairService()
     {
@@ -118,7 +114,7 @@ public class ActiveRepairService
     }
 
     /**
-     * Requests repairs for the given table and column families, and blocks 
until all repairs have been completed.
+     * Requests repairs for the given keyspace and column families.
      *
      * @return Future for asynchronous call or null if there is no need to 
repair
      */
@@ -252,12 +248,12 @@ public class ActiveRepairService
     }
 
     /**
-     * A Strategy to handle building and validating a merkle tree for a column 
family.
+     * A Strategy to handle building a merkle tree for a column family.
      *
      * Lifecycle:
      * 1. prepare() - Initialize tree with samples.
      * 2. add() - 0 or more times, to add hashes to the tree.
-     * 3. complete() - Enqueues any operations that were blocked waiting for a 
valid tree.
+     * 3. complete() - complete building tree and send it back to the initiator
      */
     public static class Validator implements Runnable
     {
@@ -332,21 +328,9 @@ public class ActiveRepairService
         }
 
         /**
-         * Called (in order) for every row present in the CF.
+         * Called (in order) for rows in given range present in the CF.
          * Hashes the row, and adds it to the tree being built.
          *
-         * There are four possible cases:
-         *  1. Token is greater than range.right (we haven't generated a range 
for it yet),
-         *  2. Token is less than/equal to range.left (the range was valid),
-         *  3. Token is contained in the range (the range is in progress),
-         *  4. No more invalid ranges exist.
-         *
-         * TODO: Because we only validate completely empty trees at the 
moment, we
-         * do not bother dealing with case 2 and case 4 should result in an 
error.
-         *
-         * Additionally, there is a special case for the minimum token, because
-         * although it sorts first, it is contained in the last possible range.
-         *
          * @param row The row.
          */
         public void add(AbstractCompactedRow row)
@@ -381,7 +365,7 @@ public class ActiveRepairService
         }
 
         /**
-         * Registers the newly created tree for rendezvous in 
Stage.ANTIENTROPY.
+         * Registers the newly created tree for rendezvous in 
Stage.ANTI_ENTROPY.
          */
         public void complete()
         {
@@ -405,7 +389,7 @@ public class ActiveRepairService
         }
 
         /**
-         * Called after the validation lifecycle to respond with the now valid 
tree. Runs in Stage.ANTIENTROPY.
+         * Called after the validation lifecycle to respond with the now valid 
tree. Runs in Stage.ANTI_ENTROPY.
          */
         public void run()
         {
@@ -449,7 +433,6 @@ public class ActiveRepairService
 
     /**
      * Handler for requests from remote nodes to generate a valid tree.
-     * The payload is a CFPair representing the columnfamily to validate.
      */
     public static class TreeRequestVerbHandler implements 
IVerbHandler<TreeRequest>
     {
@@ -578,7 +561,6 @@ public class ActiveRepairService
 
     /**
      * Triggers repairs with all neighbors for the given table, cfs and range.
-     * Typical lifecycle is: start() then join(). Executed in client threads.
      */
     static class RepairSession extends WrappedRunnable implements 
IEndpointStateChangeSubscriber, IFailureDetectionEventListener
     {
@@ -718,7 +700,7 @@ public class ActiveRepairService
         }
 
         /**
-         * @return wheather this session is terminated
+         * @return whether this session is terminated
          */
         public boolean terminated()
         {
@@ -735,7 +717,7 @@ public class ActiveRepairService
         }
 
         /**
-         * clear all RepairJobs and terminate this session.
+         * terminate this session.
          */
         public void forceShutdown()
         {
@@ -933,7 +915,7 @@ public class ActiveRepairService
             }
 
             /**
-             * @return true if the @param differencer was the last remaining
+             * @return true if the differencer was the last remaining
              */
             synchronized boolean completedSynchronization(Differencer 
differencer)
             {

Reply via email to