voldemort.cluster.failuredetector
Class BannagePeriodFailureDetector
java.lang.Object
voldemort.cluster.failuredetector.AbstractFailureDetector
voldemort.cluster.failuredetector.BannagePeriodFailureDetector
- All Implemented Interfaces:
- FailureDetector
public class BannagePeriodFailureDetector
- extends AbstractFailureDetector
BannagePeriodFailureDetector relies on external callers to notify it of
failed attempts to access a node's store via recordException. When
recordException is invoked, the node is marked offline for a period of time
as defined by the client or server configuration. Once that period has
passed, the node is considered available. However,
BannagePeriodFailureDetector's definition of available uses a fairly loose
sense of the word. Rather than considering the node to be available for
access, it is available for attempting to access. In actuality the
node may still be down. However, the intent is simply to mark it down for N
seconds and then attempt to try again and repeat. If the node is truly
available for access, the caller will then invoke recordSuccess and the node
will be marked available in the truest sense of the word.
- See Also:
VoldemortConfig.getFailureDetectorBannagePeriod(),
ClientConfig.getFailureDetectorBannagePeriod(),
FailureDetectorConfig.getBannagePeriod()
| Methods inherited from class voldemort.cluster.failuredetector.AbstractFailureDetector |
addFailureDetectorListener, checkArgs, checkNodeArg, destroy, getAvailableNodeCount, getAvailableNodes, getConfig, getLastChecked, getNodeCount, getNodeStatus, getUnavailableNodes, removeFailureDetectorListener, setAvailable, setUnavailable, waitForAvailability |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BannagePeriodFailureDetector
public BannagePeriodFailureDetector(FailureDetectorConfig failureDetectorConfig)
isAvailable
public boolean isAvailable(Node node)
- Description copied from interface:
FailureDetector
- Determines if the node is available or offline.
The isAvailable method is a simple boolean operation to determine if the
node in question is available. As expected, the result of this call is an
approximation given race conditions. However, the FailureDetector should
do its best to determine the then-current state of the cluster to produce
a minimum of false negatives and false positives.
Note: this determination is approximate and differs based upon the
algorithm used by the implementation.
- Parameters:
node - Node to check
- Returns:
- True if available, false otherwise
recordException
public void recordException(Node node,
long requestTime,
UnreachableStoreException e)
- Description copied from interface:
FailureDetector
- Allows external callers to provide input to the FailureDetector that an
error occurred when trying to access the node. The implementation is free
to use or ignore this input. It can be considered a "hint" to the
FailureDetector rather than an absolute truth. For example, it is
possible to call recordException for a given node and have an immediate
call to isAvailable return true, depending on the implementation.
- Parameters:
node - Node to checkrequestTime - Length of time (in milliseconds) to perform requeste - Exception that occurred when trying to access the node
recordSuccess
public void recordSuccess(Node node,
long requestTime)
- Description copied from interface:
FailureDetector
- Allows external callers to provide input to the FailureDetector that an
access to the node succeeded. As with recordException, the implementation
is free to use or ignore this input. It can be considered a "hint" to the
FailureDetector rather than gospel truth.
Note for implementors: because of threading issues it's possible
for multiple threads to attempt access to a node and some fail and some
succeed. In a classic last-one-in-wins scenario, it's possible for the
failures to be recorded first and then the successes. It would be prudent
for implementations not to immediately assume that the node is then
available.
- Parameters:
node - Node to checkrequestTime - Length of time (in milliseconds) to perform request
getUnavailableNodesBannageExpiration
public java.lang.String getUnavailableNodesBannageExpiration()
Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao