Allow overriding RING_DELAY.

Patch by brandonwilliams reviewed by slebresne for CASSANDRA-3600

git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-1.0@1213346 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brandon Williams 2011-12-12 18:22:13 +00:00
parent 55af99a3d9
commit 8cf9f2deda
5 changed files with 21 additions and 12 deletions

View File

@ -1020,6 +1020,7 @@ url=${svn.entry.url}?pathrev=${svn.entry.commit.revision}
<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.commit.revision}
<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.commit.revision}
<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 -->

View File

@ -377,9 +377,8 @@ public class Gossiper implements IFailureDetectionEventListener, GossiperMBean
* @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 IFailureDetectionEventListener, GossiperMBean
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)
{

View File

@ -79,7 +79,7 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe
{
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 IEndpointStateChangeSubscriber, StorageSe
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.
@ -2328,11 +2339,6 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe
* @param tokenString token for the node
*/
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);
@ -2380,7 +2386,7 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe
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);

View File

@ -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"

View File

@ -125,7 +125,7 @@ public class RemoveTest extends CleanupHelper
{
try
{
ss.removeToken(token, 0);
ss.removeToken(token);
}
catch (Exception e)
{