cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r904698 - in /incubator/cassandra/trunk/src/java/org/apache/cassandra: dht/BootStrapper.java io/Streaming.java service/StorageService.java
Date Sat, 30 Jan 2010 00:50:53 GMT
Author: jbellis
Date: Sat Jan 30 00:50:52 2010
New Revision: 904698

URL: http://svn.apache.org/viewvc?rev=904698&view=rev
Log:
imrove Streaming commenting.  patch by jbellis

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/io/Streaming.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java?rev=904698&r1=904697&r2=904698&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java Sat Jan
30 00:50:52 2010
@@ -43,15 +43,6 @@
  import com.google.common.collect.ArrayListMultimap;
 
 
- /**
-  * This class handles the bootstrapping responsibilities for the local endpoint.
-  *
-  *  - bootstrapTokenVerb asks the most-loaded node what Token to use to split its Range
in two.
-  *  - streamRequestVerb tells source nodes to send us the necessary Ranges
-  *  - source nodes send streamInitiateVerb to us to say "get ready to receive data" [if
there is data to send]
-  *  - when we have everything set up to receive the data, we send streamInitiateDoneVerb
back to the source nodes and they start streaming
-  *  - when streaming is complete, we send streamFinishedVerb to the source so it can clean
up on its end
-  */
 public class BootStrapper
 {
     private static final Logger logger = Logger.getLogger(BootStrapper.class);
@@ -89,8 +80,6 @@
                     InetAddress source = entry.getKey();
                     for (String table : DatabaseDescriptor.getNonSystemTables())
                         StorageService.instance.addBootstrapSource(source, table);
-                    if (logger.isDebugEnabled())
-                        logger.debug("Requesting from " + source + " ranges " + StringUtils.join(entry.getValue(),
", "));
                     Streaming.requestRanges(source, entry.getValue());
                 }
             }

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/io/Streaming.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/io/Streaming.java?rev=904698&r1=904697&r2=904698&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/io/Streaming.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/io/Streaming.java Sat Jan 30 00:50:52
2010
@@ -48,6 +48,19 @@
 import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.utils.FBUtilities;
 
+/**
+ * This class handles streaming data from one node to another.
+ *
+ * For bootstrap,
+ *  1. BOOTSTRAP_TOKEN asks the most-loaded node what Token to use to split its Range in
two.
+ *  2. STREAM_REQUEST tells source nodes to send us the necessary Ranges
+ *  3. source nodes send STREAM_INITIATE to us to say "get ready to receive data" [if there
is data to send]
+ *  4. when we have everything set up to receive the data, we send STREAM_INITIATE_DONE back
to the source nodes and they start streaming
+ *  5. when streaming is complete, we send STREAM_FINISHED to the source so it can clean
up on its end
+ *
+ * For unbootstrap, the leaving node starts with step 3 (1 and 2 are skipped entirely). 
This is why
+ * STREAM_INITIATE is a separate verb, rather than just a reply to STREAM_REQUEST; the REQUEST
is optional.
+ */
 public class Streaming
 {
     private static Logger logger = Logger.getLogger(Streaming.class);
@@ -147,6 +160,8 @@
      */
     public static void requestRanges(InetAddress source, Collection<Range> ranges)
     {
+        if (logger.isDebugEnabled())
+            logger.debug("Requesting from " + source + " ranges " + StringUtils.join(ranges,
", "));
         StreamRequestMetadata streamRequestMetadata = new StreamRequestMetadata(FBUtilities.getLocalAddress(),
ranges);
         Message message = StreamRequestMessage.makeStreamRequestMessage(new StreamRequestMessage(streamRequestMetadata));
         MessagingService.instance.sendOneWay(message, source);
@@ -216,7 +231,7 @@
 
         public String getNewFileNameFromOldContextAndNames(Map<String, String> fileNames,
                                                            Map<String, String> pathNames,
-                StreamContextManager.StreamContext streamContext)
+                                                           StreamContextManager.StreamContext
streamContext)
         {
             File sourceFile = new File( streamContext.getTargetFile() );
             String[] piece = FBUtilities.strip(sourceFile.getName(), "-");

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java?rev=904698&r1=904697&r2=904698&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java Sat
Jan 30 00:50:52 2010
@@ -707,14 +707,9 @@
                 }
             }
 
-            // Finally we have a list of addresses and ranges to
-            // stream. Proceed to stream
+            // Finally we have a list of addresses and ranges to stream. Proceed to stream
             for (Map.Entry<InetAddress, Collection<Range>> entry : sourceRanges.asMap().entrySet())
-            {
-                if (logger_.isDebugEnabled())
-                    logger_.debug("Requesting from " + entry.getKey() + " ranges " + StringUtils.join(entry.getValue(),
", "));
                 Streaming.requestRanges(entry.getKey(), entry.getValue());
-            }
         }
     }
 



Mime
View raw message