Author: jbellis
Date: Sat May 22 01:24:25 2010
New Revision: 947225
URL: http://svn.apache.org/viewvc?rev=947225&view=rev
Log:
expose PhiConvictThreshold. patch by Brandon Williams; reviewed by Roger
Schildmeijer for CASSANDRA-1053
Modified:
cassandra/branches/cassandra-0.6/CHANGES.txt
cassandra/branches/cassandra-0.6/conf/storage-conf.xml
cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/gms/FailureDetector.java
cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/gms/FailureDetectorMBean.java
Modified: cassandra/branches/cassandra-0.6/CHANGES.txt
URL:
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/CHANGES.txt?rev=947225&r1=947224&r2=947225&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.6/CHANGES.txt Sat May 22 01:24:25 2010
@@ -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
Modified: cassandra/branches/cassandra-0.6/conf/storage-conf.xml
URL:
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/conf/storage-conf.xml?rev=947225&r1=947224&r2=947225&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/conf/storage-conf.xml (original)
+++ cassandra/branches/cassandra-0.6/conf/storage-conf.xml Sat May 22 01:24:25
2010
@@ -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>
Modified:
cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
URL:
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=947225&r1=947224&r2=947225&view=diff
==============================================================================
---
cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
(original)
+++
cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
Sat May 22 01:24:25 2010
@@ -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;
Modified:
cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/gms/FailureDetector.java
URL:
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/gms/FailureDetector.java?rev=947225&r1=947224&r2=947225&view=diff
==============================================================================
---
cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/gms/FailureDetector.java
(original)
+++
cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/gms/FailureDetector.java
Sat May 22 01:24:25 2010
@@ -33,6 +33,7 @@ import org.apache.commons.lang.StringUti
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
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
public FailureDetector()
{
+ phiConvictThreshold_ = DatabaseDescriptor.getPhiConvictThreshold();
creationTime_ = System.currentTimeMillis();
// Register this instance with JMX
try
@@ -110,6 +112,16 @@ public class FailureDetector implements
throw new IOError(e);
}
}
+
+ public void setPhiConvictThreshold(int phi)
+ {
+ phiConvictThreshold_ = phi;
+ }
+
+ public int getPhiConvictThreshold()
+ {
+ return phiConvictThreshold_;
+ }
public boolean isAlive(InetAddress ep)
{
Modified:
cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/gms/FailureDetectorMBean.java
URL:
http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/gms/FailureDetectorMBean.java?rev=947225&r1=947224&r2=947225&view=diff
==============================================================================
---
cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/gms/FailureDetectorMBean.java
(original)
+++
cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/gms/FailureDetectorMBean.java
Sat May 22 01:24:25 2010
@@ -21,4 +21,8 @@ package org.apache.cassandra.gms;
public interface FailureDetectorMBean
{
public void dumpInterArrivalTimes();
+
+ public void setPhiConvictThreshold(int phi);
+
+ public int getPhiConvictThreshold();
}