cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brandonwilli...@apache.org
Subject svn commit: r1213346 - in /cassandra/branches/cassandra-1.0: build.xml src/java/org/apache/cassandra/gms/Gossiper.java src/java/org/apache/cassandra/service/StorageService.java test/cassandra.in.sh test/unit/org/apache/cassandra/service/RemoveTest.java
Date Mon, 12 Dec 2011 18:22:13 GMT
Author: brandonwilliams
Date: Mon Dec 12 18:22:13 2011
New Revision: 1213346

URL: http://svn.apache.org/viewvc?rev=1213346&view=rev
Log:
Allow overriding RING_DELAY.
Patch by brandonwilliams reviewed by slebresne for CASSANDRA-3600

Modified:
    cassandra/branches/cassandra-1.0/build.xml
    cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/gms/Gossiper.java
    cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/service/StorageService.java
    cassandra/branches/cassandra-1.0/test/cassandra.in.sh
    cassandra/branches/cassandra-1.0/test/unit/org/apache/cassandra/service/RemoveTest.java

Modified: cassandra/branches/cassandra-1.0/build.xml
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0/build.xml?rev=1213346&r1=1213345&r2=1213346&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0/build.xml (original)
+++ cassandra/branches/cassandra-1.0/build.xml Mon Dec 12 18:22:13 2011
@@ -1020,6 +1020,7 @@ url=${svn.entry.url}?pathrev=${svn.entry
     <testmacro suitename="unit" inputdir="${test.unit.src}" timeout="60000">
       <jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
       <jvmarg value="-Dcorrupt-sstable-root=${test.data}/corrupt-sstables"/>
+      <jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
     </testmacro>
   </target>
     
@@ -1028,6 +1029,7 @@ url=${svn.entry.url}?pathrev=${svn.entry
       <jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
       <jvmarg value="-Dcorrupt-sstable-root=${test.data}/corrupt-sstables"/>
       <jvmarg value="-Dcassandra.test.compression=true"/>
+      <jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
     </testmacro>
   </target>
 
@@ -1054,6 +1056,7 @@ url=${svn.entry.url}?pathrev=${svn.entry
   <target name="long-test" depends="build-test" description="Execute functional tests">
     <testmacro suitename="long" inputdir="${test.long.src}"
                timeout="${test.long.timeout}" />
+      <jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
   </target>
 
   <!-- instruments the classes to later create code coverage reports -->

Modified: cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/gms/Gossiper.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/gms/Gossiper.java?rev=1213346&r1=1213345&r2=1213346&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/gms/Gossiper.java (original)
+++ cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/gms/Gossiper.java Mon Dec
12 18:22:13 2011
@@ -377,9 +377,8 @@ public class Gossiper implements IFailur
      * @param endpoint - the endpoint being removed
      * @param token - the token being removed
      * @param mytoken - my own token for replication coordination
-     * @param delay
      */
-    public void advertiseRemoving(InetAddress endpoint, Token token, Token mytoken, int delay)
+    public void advertiseRemoving(InetAddress endpoint, Token token, Token mytoken)
     {
         EndpointState epState = endpointStateMap.get(endpoint);
         // remember this node's generation
@@ -388,7 +387,7 @@ public class Gossiper implements IFailur
         logger.info("Sleeping for " + StorageService.RING_DELAY + "ms to ensure " + endpoint
+ " does not change");
         try
         {
-            Thread.sleep(delay);
+            Thread.sleep(StorageService.RING_DELAY);
         }
         catch (InterruptedException e)
         {

Modified: cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/service/StorageService.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/service/StorageService.java?rev=1213346&r1=1213345&r2=1213346&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/service/StorageService.java
(original)
+++ cassandra/branches/cassandra-1.0/src/java/org/apache/cassandra/service/StorageService.java
Mon Dec 12 18:22:13 2011
@@ -79,7 +79,7 @@ public class StorageService implements I
 {
     private static Logger logger_ = LoggerFactory.getLogger(StorageService.class);
 
-    public static final int RING_DELAY = 30 * 1000; // delay after which we assume ring has
stablized
+    public static final int RING_DELAY = getRingDelay(); // delay after which we assume ring
has stablized
 
     /* All verb handler identifiers */
     public enum Verb
@@ -150,6 +150,17 @@ public class StorageService implements I
         put(Verb.UNUSED_3, Stage.INTERNAL_RESPONSE);
     }};
 
+    private static int getRingDelay()
+    {
+        String newdelay = System.getProperty("cassandra.ring_delay_ms");
+        if (newdelay != null)
+        {
+            logger_.warn("Overriding RING_DELAY to {}ms", newdelay);
+            return Integer.parseInt(newdelay);
+        }
+        else
+            return 30 * 1000;
+    }
 
     /**
      * This pool is used for periodic short (sub-second) tasks.
@@ -2329,11 +2340,6 @@ public class StorageService implements I
      */
     public void removeToken(String tokenString)
     {
-        removeToken(tokenString, RING_DELAY);
-    }
-
-    public void removeToken(String tokenString, int delay)
-    {
         InetAddress myAddress = FBUtilities.getBroadcastAddress();
         Token localToken = tokenMetadata_.getToken(myAddress);
         Token token = partitioner.getTokenFactory().fromString(tokenString);
@@ -2380,7 +2386,7 @@ public class StorageService implements I
         calculatePendingRanges();
         // the gossiper will handle spoofing this node's state to REMOVING_TOKEN for us
         // we add our own token so other nodes to let us know when they're done
-        Gossiper.instance.advertiseRemoving(endpoint, token, localToken, delay);
+        Gossiper.instance.advertiseRemoving(endpoint, token, localToken);
 
         // kick off streaming commands
         restoreReplicaCount(endpoint, myAddress);

Modified: cassandra/branches/cassandra-1.0/test/cassandra.in.sh
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0/test/cassandra.in.sh?rev=1213346&r1=1213345&r2=1213346&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0/test/cassandra.in.sh (original)
+++ cassandra/branches/cassandra-1.0/test/cassandra.in.sh Mon Dec 12 18:22:13 2011
@@ -50,4 +50,5 @@ JVM_OPTS=" \
         -XX:+HeapDumpOnOutOfMemoryError \
         -Dcom.sun.management.jmxremote.port=8090 \
         -Dcom.sun.management.jmxremote.ssl=false \
-        -Dcom.sun.management.jmxremote.authenticate=false"
+        -Dcom.sun.management.jmxremote.authenticate=false \
+        -Dcassandra.ring_delay_ms=1000"

Modified: cassandra/branches/cassandra-1.0/test/unit/org/apache/cassandra/service/RemoveTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0/test/unit/org/apache/cassandra/service/RemoveTest.java?rev=1213346&r1=1213345&r2=1213346&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0/test/unit/org/apache/cassandra/service/RemoveTest.java
(original)
+++ cassandra/branches/cassandra-1.0/test/unit/org/apache/cassandra/service/RemoveTest.java
Mon Dec 12 18:22:13 2011
@@ -125,7 +125,7 @@ public class RemoveTest extends CleanupH
             {
                 try
                 {
-                    ss.removeToken(token, 0);
+                    ss.removeToken(token);
                 }
                 catch (Exception e)
                 {



Mime
View raw message