mirror of https://github.com/apache/cassandra
expose PhiConvictThreshold. patch by Brandon Williams; reviewed by Roger Schildmeijer for CASSANDRA-1053
git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.6@947225 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
399087f891
commit
9255a191bc
|
|
@ -24,6 +24,7 @@
|
|||
(CASSANDRA-1100)
|
||||
* windows scripts for SSTableImport/Export (CASSANDRA-1051)
|
||||
* windows script for nodetool (CASSANDRA-1113)
|
||||
* expose PhiConvictThreshold (CASSANDRA-1053)
|
||||
|
||||
|
||||
0.6.1
|
||||
|
|
|
|||
|
|
@ -215,6 +215,9 @@
|
|||
|
||||
<!-- Time to wait for a reply from other nodes before failing the command -->
|
||||
<RpcTimeoutInMillis>10000</RpcTimeoutInMillis>
|
||||
<!-- phi value that must be reached before a host is marked as down.
|
||||
most users should never adjust this -->
|
||||
<!-- PhiConvictThreshold>8</PhiConvictThreshold -->
|
||||
<!-- Size to allow commitlog to grow to before creating a new segment -->
|
||||
<CommitLogRotationThresholdInMB>128</CommitLogRotationThresholdInMB>
|
||||
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ public class DatabaseDescriptor
|
|||
private static InetAddress thriftAddress;
|
||||
private static String clusterName = "Test";
|
||||
private static long rpcTimeoutInMillis = 2000;
|
||||
private static int phiConvictThreshold = 8;
|
||||
private static Set<InetAddress> seeds = new HashSet<InetAddress>();
|
||||
/* Keeps the list of data file directories */
|
||||
private static String[] dataFileDirectories;
|
||||
|
|
@ -288,6 +289,16 @@ public class DatabaseDescriptor
|
|||
if ( rpcTimeout != null )
|
||||
rpcTimeoutInMillis = Integer.parseInt(rpcTimeout);
|
||||
|
||||
/* phi convict threshold for FailureDetector */
|
||||
String phiThreshold = xmlUtils.getNodeValue("/Storage/PhiConvictThreshold");
|
||||
if ( phiThreshold != null )
|
||||
phiConvictThreshold = Integer.parseInt(phiThreshold);
|
||||
|
||||
if (phiConvictThreshold < 5 || phiConvictThreshold > 16)
|
||||
{
|
||||
throw new ConfigurationException("PhiConvictThreshold must be between 5 and 16");
|
||||
}
|
||||
|
||||
/* Thread per pool */
|
||||
String rawReaders = xmlUtils.getNodeValue("/Storage/ConcurrentReads");
|
||||
if (rawReaders != null)
|
||||
|
|
@ -1002,6 +1013,11 @@ public class DatabaseDescriptor
|
|||
return rpcTimeoutInMillis;
|
||||
}
|
||||
|
||||
public static int getPhiConvictThreshold()
|
||||
{
|
||||
return phiConvictThreshold;
|
||||
}
|
||||
|
||||
public static int getConsistencyThreads()
|
||||
{
|
||||
return consistencyThreads;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import org.apache.commons.lang.StringUtils;
|
|||
import java.net.InetAddress;
|
||||
import org.apache.cassandra.utils.FBUtilities;
|
||||
import org.apache.cassandra.utils.BoundedStatsDeque;
|
||||
import org.apache.cassandra.config.DatabaseDescriptor;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
|
@ -45,7 +46,7 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean
|
|||
public static final IFailureDetector instance = new FailureDetector();
|
||||
private static Logger logger_ = Logger.getLogger(FailureDetector.class);
|
||||
private static final int sampleSize_ = 1000;
|
||||
private static final int phiConvictThreshold_ = 8;
|
||||
private static int phiConvictThreshold_;
|
||||
/* The Failure Detector has to have been up for at least 1 min. */
|
||||
private static final long uptimeThreshold_ = 60000;
|
||||
/* The time when the module was instantiated. */
|
||||
|
|
@ -56,6 +57,7 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean
|
|||
|
||||
public FailureDetector()
|
||||
{
|
||||
phiConvictThreshold_ = DatabaseDescriptor.getPhiConvictThreshold();
|
||||
creationTime_ = System.currentTimeMillis();
|
||||
// Register this instance with JMX
|
||||
try
|
||||
|
|
@ -110,6 +112,16 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean
|
|||
throw new IOError(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void setPhiConvictThreshold(int phi)
|
||||
{
|
||||
phiConvictThreshold_ = phi;
|
||||
}
|
||||
|
||||
public int getPhiConvictThreshold()
|
||||
{
|
||||
return phiConvictThreshold_;
|
||||
}
|
||||
|
||||
public boolean isAlive(InetAddress ep)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,4 +21,8 @@ package org.apache.cassandra.gms;
|
|||
public interface FailureDetectorMBean
|
||||
{
|
||||
public void dumpInterArrivalTimes();
|
||||
|
||||
public void setPhiConvictThreshold(int phi);
|
||||
|
||||
public int getPhiConvictThreshold();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue