voldemort.cluster.failuredetector
Class FailureDetectorConfig

java.lang.Object
  extended by voldemort.cluster.failuredetector.FailureDetectorConfig

public class FailureDetectorConfig
extends java.lang.Object

FailureDetectorConfig simply holds all the data that was available to it upon construction. A FailureDetectorConfig is usually passed to FailureDetectorUtils's create method to create a full-blown FailureDetector instance.


Field Summary
protected  long asyncRecoveryInterval
           
protected  long bannagePeriod
           
protected  java.util.List<java.lang.String> catastrophicErrorTypes
           
static long DEFAULT_ASYNC_RECOVERY_INTERVAL
           
static long DEFAULT_BANNAGE_PERIOD
           
static java.util.List<java.lang.String> DEFAULT_CATASTROPHIC_ERROR_TYPES
           
static java.lang.String DEFAULT_IMPLEMENTATION_CLASS_NAME
           
static long DEFAULT_REQUEST_LENGTH_THRESHOLD
           
static int DEFAULT_THRESHOLD
           
static int DEFAULT_THRESHOLD_COUNT_MINIMUM
           
static long DEFAULT_THRESHOLD_INTERVAL
           
protected  java.lang.String implementationClassName
           
protected  java.util.Collection<Node> nodes
           
protected  long requestLengthThreshold
           
protected  StoreVerifier storeVerifier
           
protected  int threshold
           
protected  int thresholdCountMinimum
           
protected  long thresholdInterval
           
protected  Time time
           
 
Constructor Summary
FailureDetectorConfig()
          Constructs a new FailureDetectorConfig using all the defaults.
FailureDetectorConfig(ClientConfig config)
          Constructs a new FailureDetectorConfig from a client perspective (via ClientConfig).
FailureDetectorConfig(VoldemortConfig config)
          Constructs a new FailureDetectorConfig from a server perspective (via VoldemortConfig).
 
Method Summary
 void addNode(Node node)
           
 long getAsyncRecoveryInterval()
          Returns the interval of time (in milliseconds) that the thread will wait before checking if a given node has recovered.
 long getBannagePeriod()
          Returns the node bannage period (in milliseconds) as defined by the client or server configuration.
 java.util.List<java.lang.String> getCatastrophicErrorTypes()
          Returns the list of Java Exception types that are considered catastrophic.
 Cluster getCluster()
          Returns a reference to the cluster object
 java.lang.String getImplementationClassName()
          Returns the fully-qualified class name of the FailureDetector implementation.
 java.util.Collection<Node> getNodes()
          Deprecated. 
 long getRequestLengthThreshold()
          Returns the maximum time (in milliseconds) that a request (get, put, delete, etc.) can take before a given successful event is considered as a failure because the requests are--while successful--considered to be taking too long to complete.
 StoreVerifier getStoreVerifier()
           
 int getThreshold()
          Returns the success threshold percentage with an integer value between 0 and 100.
 int getThresholdCountMinimum()
          Returns the minimum number of failures that must occur before the success ratio is calculated to compare against the success threshold percentage.
 long getThresholdInterval()
          Returns the interval of time for each the success ratio is valid.
 Time getTime()
           
 void removeNode(Node node)
           
 FailureDetectorConfig setAsyncRecoveryInterval(long asyncRecoveryInterval)
          Assigns the interval of time (in milliseconds) that the thread will wait before checking if a given node has recovered.
 FailureDetectorConfig setBannagePeriod(long bannagePeriod)
          Assigns the node bannage period (in milliseconds) as defined by the client or server configuration.
 FailureDetectorConfig setCatastrophicErrorTypes(java.util.List<java.lang.String> catastrophicErrorTypes)
          Assigns the list of Java Exception types that are considered catastrophic.
 FailureDetectorConfig setCluster(Cluster cluster)
          Assigns a cluster which determines the source of truth for the topology
 FailureDetectorConfig setImplementationClassName(java.lang.String implementationClassName)
          Assigns the fully-qualified class name of the FailureDetector implementation.
 FailureDetectorConfig setNodes(java.util.Collection<Node> nodes)
          Deprecated. 
 FailureDetectorConfig setRequestLengthThreshold(long requestLengthThreshold)
          Assigns the value for the maximum time (in milliseconds) that a request (get, put, delete, etc.) can take before a given successful event is considered as a failure because the requests are--while successful--considered to be taking too long to complete.
 FailureDetectorConfig setStoreVerifier(StoreVerifier storeVerifier)
           
 FailureDetectorConfig setThreshold(int threshold)
          Assigns the success threshold percentage with an integer value between 0 and 100.
 FailureDetectorConfig setThresholdCountMinimum(int thresholdCountMinimum)
          Assigns the minimum number of failures that must occur before the success ratio is calculated to compare against the success threshold percentage.
 FailureDetectorConfig setThresholdInterval(long thresholdInterval)
          Assigns the interval of time for each the success ratio is valid.
 FailureDetectorConfig setTime(Time time)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_IMPLEMENTATION_CLASS_NAME

public static final java.lang.String DEFAULT_IMPLEMENTATION_CLASS_NAME

DEFAULT_BANNAGE_PERIOD

public static final long DEFAULT_BANNAGE_PERIOD
See Also:
Constant Field Values

DEFAULT_THRESHOLD_INTERVAL

public static final long DEFAULT_THRESHOLD_INTERVAL
See Also:
Constant Field Values

DEFAULT_THRESHOLD

public static final int DEFAULT_THRESHOLD
See Also:
Constant Field Values

DEFAULT_THRESHOLD_COUNT_MINIMUM

public static final int DEFAULT_THRESHOLD_COUNT_MINIMUM
See Also:
Constant Field Values

DEFAULT_ASYNC_RECOVERY_INTERVAL

public static final long DEFAULT_ASYNC_RECOVERY_INTERVAL
See Also:
Constant Field Values

DEFAULT_CATASTROPHIC_ERROR_TYPES

public static final java.util.List<java.lang.String> DEFAULT_CATASTROPHIC_ERROR_TYPES

DEFAULT_REQUEST_LENGTH_THRESHOLD

public static final long DEFAULT_REQUEST_LENGTH_THRESHOLD
See Also:
Constant Field Values

implementationClassName

protected java.lang.String implementationClassName

bannagePeriod

protected long bannagePeriod

threshold

protected int threshold

thresholdCountMinimum

protected int thresholdCountMinimum

thresholdInterval

protected long thresholdInterval

asyncRecoveryInterval

protected long asyncRecoveryInterval

catastrophicErrorTypes

protected java.util.List<java.lang.String> catastrophicErrorTypes

requestLengthThreshold

protected long requestLengthThreshold

nodes

protected java.util.Collection<Node> nodes

storeVerifier

protected StoreVerifier storeVerifier

time

protected Time time
Constructor Detail

FailureDetectorConfig

public FailureDetectorConfig()
Constructs a new FailureDetectorConfig using all the defaults. This is usually used in the case of unit tests.

Note: the setNodes(Collection) and setStoreVerifier(StoreVerifier) methods must be called to ensure complete configuration.


FailureDetectorConfig

public FailureDetectorConfig(VoldemortConfig config)
Constructs a new FailureDetectorConfig from a server perspective (via VoldemortConfig).

Note: the setNodes(Collection) and setStoreVerifier(StoreVerifier) methods must be called to ensure complete configuration.

Parameters:
config - VoldemortConfig instance

FailureDetectorConfig

public FailureDetectorConfig(ClientConfig config)
Constructs a new FailureDetectorConfig from a client perspective (via ClientConfig).

Note: the setNodes(Collection) and setStoreVerifier(StoreVerifier) methods must be called to ensure complete configuration.

Parameters:
config - ClientConfig instance
Method Detail

getImplementationClassName

public java.lang.String getImplementationClassName()
Returns the fully-qualified class name of the FailureDetector implementation.

Returns:
Class name to instantiate for the FailureDetector
See Also:
VoldemortConfig.getFailureDetectorImplementation(), ClientConfig.getFailureDetectorImplementation()

setImplementationClassName

public FailureDetectorConfig setImplementationClassName(java.lang.String implementationClassName)
Assigns the fully-qualified class name of the FailureDetector implementation.

Parameters:
implementationClassName - Class name to instantiate for the FailureDetector
See Also:
VoldemortConfig.getFailureDetectorImplementation(), ClientConfig.getFailureDetectorImplementation()

getBannagePeriod

public long getBannagePeriod()
Returns the node bannage period (in milliseconds) as defined by the client or server configuration. Some FailureDetector implementations wait for a specified period of time before attempting to access the node again once it has become unavailable.

Note: this is only used by the BannagePeriodFailureDetector implementation.

Returns:
Period of bannage of a node, in milliseconds
See Also:
BannagePeriodFailureDetector, VoldemortConfig.getFailureDetectorBannagePeriod(), ClientConfig.getFailureDetectorBannagePeriod()

setBannagePeriod

public FailureDetectorConfig setBannagePeriod(long bannagePeriod)
Assigns the node bannage period (in milliseconds) as defined by the client or server configuration. Some FailureDetector implementations wait for a specified period of time before attempting to access the node again once it has become unavailable.

Note: this is only used by the BannagePeriodFailureDetector implementation.

Parameters:
bannagePeriod - Period of bannage of a node, in milliseconds
See Also:
BannagePeriodFailureDetector, VoldemortConfig.getFailureDetectorBannagePeriod(), ClientConfig.getFailureDetectorBannagePeriod()

getThreshold

public int getThreshold()
Returns the success threshold percentage with an integer value between 0 and 100. Some FailureDetector implementations will mark a node as unavailable if the ratio of successes to total requests for that node falls under this threshold.

Note: this is only used by the ThresholdFailureDetector implementation.

Returns:
Integer percentage representing success threshold
See Also:
ThresholdFailureDetector, VoldemortConfig.getFailureDetectorThreshold(), ClientConfig.getFailureDetectorThreshold()

setThreshold

public FailureDetectorConfig setThreshold(int threshold)
Assigns the success threshold percentage with an integer value between 0 and 100. Some FailureDetector implementations will mark a node as unavailable if the ratio of successes to total requests for that node falls under this threshold.

Note: this is only used by the ThresholdFailureDetector implementation.

Parameters:
threshold - Integer percentage representing success threshold
Throws:
java.lang.IllegalArgumentException - Thrown if the threshold parameter is outside the range [0..100]
See Also:
ThresholdFailureDetector, VoldemortConfig.getFailureDetectorThreshold(), ClientConfig.getFailureDetectorThreshold()

getThresholdCountMinimum

public int getThresholdCountMinimum()
Returns the minimum number of failures that must occur before the success ratio is calculated to compare against the success threshold percentage.

Note: this is only used by the ThresholdFailureDetector implementation.

Returns:
Integer representing the minimum number of failures (per node) that must be processed before the threshold is checked
See Also:
ThresholdFailureDetector, VoldemortConfig.getFailureDetectorThreshold(), ClientConfig.getFailureDetectorThreshold()

setThresholdCountMinimum

public FailureDetectorConfig setThresholdCountMinimum(int thresholdCountMinimum)
Assigns the minimum number of failures that must occur before the success ratio is calculated to compare against the success threshold percentage.

Note: this is only used by the ThresholdFailureDetector implementation.

Parameters:
thresholdCountMinimum - Integer representing the minimum number of failures (per node) that must be processed before the threshold is checked
Throws:
java.lang.IllegalArgumentException - Thrown if the thresholdCountMinimum parameter is outside the range [0..Integer.MAX_VALUE]
See Also:
ThresholdFailureDetector, VoldemortConfig.getFailureDetectorThreshold(), ClientConfig.getFailureDetectorThreshold()

getThresholdInterval

public long getThresholdInterval()
Returns the interval of time for each the success ratio is valid. After this number of milliseconds passes, a new interval is started and all internal state of a node is cleared out. However, it may not necessarily be marked as available if it was unavailable in the previous interval.

Note: this is only used by the ThresholdFailureDetector implementation.

Returns:
Millisecond interval for the success ratio
See Also:
ThresholdFailureDetector, VoldemortConfig.getFailureDetectorThresholdInterval(), ClientConfig.getFailureDetectorThresholdInterval()

setThresholdInterval

public FailureDetectorConfig setThresholdInterval(long thresholdInterval)
Assigns the interval of time for each the success ratio is valid. After this number of milliseconds passes, a new interval is started and all internal state of a node is cleared out. However, it may not necessarily be marked as available if it was unavailable in the previous interval.

Note: this is only used by the ThresholdFailureDetector implementation.

Parameters:
thresholdInterval - Millisecond interval for the success ratio
Throws:
java.lang.IllegalArgumentException - Thrown if the thresholdInterval parameter is less than or equal to 0
See Also:
ThresholdFailureDetector, VoldemortConfig.getFailureDetectorThresholdInterval(), ClientConfig.getFailureDetectorThresholdInterval()

getAsyncRecoveryInterval

public long getAsyncRecoveryInterval()
Returns the interval of time (in milliseconds) that the thread will wait before checking if a given node has recovered.

Note: this is only used by the AsyncRecoveryFailureDetector and ThresholdFailureDetector implementations.

Returns:
Integer representing the millisecond interval for the success ratio
See Also:
AsyncRecoveryFailureDetector, ThresholdFailureDetector, VoldemortConfig.getFailureDetectorAsyncRecoveryInterval(), ClientConfig.getFailureDetectorAsyncRecoveryInterval()

setAsyncRecoveryInterval

public FailureDetectorConfig setAsyncRecoveryInterval(long asyncRecoveryInterval)
Assigns the interval of time (in milliseconds) that the thread will wait before checking if a given node has recovered.

Note: this is only used by the AsyncRecoveryFailureDetector and ThresholdFailureDetector implementations.

Parameters:
asyncRecoveryInterval - Number of milliseconds to wait between recovery attempts
Throws:
java.lang.IllegalArgumentException - Thrown if the thresholdInterval parameter is less than or equal to 0
See Also:
AsyncRecoveryFailureDetector, ThresholdFailureDetector, VoldemortConfig.getFailureDetectorAsyncRecoveryInterval(), ClientConfig.getFailureDetectorAsyncRecoveryInterval()

getCatastrophicErrorTypes

public java.util.List<java.lang.String> getCatastrophicErrorTypes()
Returns the list of Java Exception types that are considered catastrophic. Some FailureDetector implementations may not mark a given node as unavailable on each and every call to recordException. Instead they may apply logic to determine if such an exception should cause the node to be marked as unavailable. However, the list of so-called catastrophic errors provides such FailureDetector implementations a hint that receipt of such errors should cause the node to be marked as unavailable immediately, regardless of other logic.

Note: this is only used by the ThresholdFailureDetector implementation.

Returns:
List of fully-qualified Java Exception class names against which to check the exception provided to recordException; this list should be immutable
See Also:
ThresholdFailureDetector, VoldemortConfig.getFailureDetectorCatastrophicErrorTypes(), ClientConfig.getFailureDetectorCatastrophicErrorTypes()

setCatastrophicErrorTypes

public FailureDetectorConfig setCatastrophicErrorTypes(java.util.List<java.lang.String> catastrophicErrorTypes)
Assigns the list of Java Exception types that are considered catastrophic. Some FailureDetector implementations may not mark a given node as unavailable on each and every call to recordException. Instead they may apply logic to determine if such an exception should cause the node to be marked as unavailable. However, the list of so-called catastrophic errors provides such FailureDetector implementations a hint that receipt of such errors should cause the node to be marked as unavailable immediately, regardless of other logic.

Note: this is only used by the ThresholdFailureDetector implementation.

Parameters:
catastrophicErrorTypes - List of fully-qualified Java Exception class names against which to check the exception provided to recordException; this list should be immutable and non-null
See Also:
ThresholdFailureDetector, VoldemortConfig.getFailureDetectorCatastrophicErrorTypes(), ClientConfig.getFailureDetectorCatastrophicErrorTypes()

getRequestLengthThreshold

public long getRequestLengthThreshold()
Returns the maximum time (in milliseconds) that a request (get, put, delete, etc.) can take before a given successful event is considered as a failure because the requests are--while successful--considered to be taking too long to complete.

Note: this is only used by the ThresholdFailureDetector implementation.

Returns:
Number of milliseconds representing maximum amount of time the request should take before being considered as a failure
See Also:
ThresholdFailureDetector, VoldemortConfig.getFailureDetectorRequestLengthThreshold(), ClientConfig.getFailureDetectorRequestLengthThreshold()

setRequestLengthThreshold

public FailureDetectorConfig setRequestLengthThreshold(long requestLengthThreshold)
Assigns the value for the maximum time (in milliseconds) that a request (get, put, delete, etc.) can take before a given successful event is considered as a failure because the requests are--while successful--considered to be taking too long to complete.

Note: this is only used by the ThresholdFailureDetector implementation.

Parameters:
requestLengthThreshold - Number of milliseconds representing maximum amount of time the request should take before being considered as a failure
Throws:
java.lang.IllegalArgumentException - Thrown if the requestLengthThreshold parameter is less than 0
See Also:
ThresholdFailureDetector, VoldemortConfig.getFailureDetectorRequestLengthThreshold(), ClientConfig.getFailureDetectorRequestLengthThreshold()

getCluster

public Cluster getCluster()
Returns a reference to the cluster object

Returns:
Cluster object which determines the source of truth for the topology

setCluster

public FailureDetectorConfig setCluster(Cluster cluster)
Assigns a cluster which determines the source of truth for the topology

Parameters:
cluster - The Cluster object retrieved during bootstrap; must be non-null

getNodes

@Deprecated
public java.util.Collection<Node> getNodes()
Deprecated. 

Returns a list of nodes in the cluster represented by this failure detector configuration.

Returns:
Collection of Node instances, usually determined from the Cluster

setNodes

@Deprecated
public FailureDetectorConfig setNodes(java.util.Collection<Node> nodes)
Deprecated. 

Assigns a list of nodes in the cluster represented by this failure detector configuration.

Parameters:
nodes - Collection of Node instances, usually determined from the Cluster; must be non-null

addNode

public void addNode(Node node)

removeNode

public void removeNode(Node node)

getStoreVerifier

public StoreVerifier getStoreVerifier()

setStoreVerifier

public FailureDetectorConfig setStoreVerifier(StoreVerifier storeVerifier)

getTime

public Time getTime()

setTime

public FailureDetectorConfig setTime(Time time)


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu